Level: Junior-Level
Round: Online Assessment · Type: Coding · Difficulty: 6/10 · Duration: 60 min · Interviewer: Unfriendly
Topics: Arrays, Graphs, Depth-First Search, Stacks
Location: San Francisco, CA
Interview date: 2026-02-15
I had an online assessment with two questions.
The online assessment included these two coding questions:
Price Discount: Given a prices array, find the first number to the right of each element that is smaller than the element itself. The difference between these two numbers is the discount. If there is no number smaller, no discount is applied.
Minimum Edge Reversal to Make All Edges Point Away from a Root:
Optimize a directed graph representing a neural network by selecting a root node that minimizes the number of edge reversals needed.
The graph has:
g_from[i] to g_to[i]Task
Example
g_nodes = 4 g_from = [1, 2, 3] g_to = [4, 4, 4]
This means the directed edges are:
1 → 4 2 → 4 3 → 4
Explanation
If node 2 is selected as the root:
Edges 1 → 4 and 3 → 4 must be reversed
So they become:
4 → 1 4 → 3
Edge 2 → 4 already flows away from the root and does not need reversal
Minimum number of edges to invert = 2