Reported September 2026
Robinhoodgraph

Unique Transitive Dependent Counts

Reported by candidates from Robinhood's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Robinhood OA. Under 2s to a working solution.
Founder's read

The Robinhood OA reported in September 2026 looks like a simple graph count until the diamond shows up. You get names and [dependent, dependency] rows, and for each name you return how many distinct known nodes depend on it, directly or through a chain. This is a graph reachability problem on a DAG, and the trap is counting the same dependent twice when two paths reach it. Example 1 spells it out: d hangs off both b and c, so a still gets 3, not 4. If you've got the OA in a day or two, this is the one to rehearse. StealthCoder is the safety net if you blank mid-assessment.

The problem

You are given a list of known node names and directed dependency rows. A row [dependent, dependency] means dependent relies on dependency.
For each name in the original names order, return the number of distinct known nodes that depend on it directly or through one or more intermediate dependencies. Count a reachable node once even when several paths reach it. Ignore a dependency row when either endpoint is absent from names.
The retained known-node graph is a directed acyclic graph.

Function
uniqueDependentCounts(names: String[], dependencies: String[][]) → int[]

Examples
Example 1
names = ["a","b","c","d"]
dependencies = [["b","a"],["c","a"],["d","b"],["d","c"]]
return = [3,1,1,0]
a reaches b, c, and d; d is counted only once despite two paths.
Example 2
names = ["x","y"]
dependencies = [["z","x"],["y","missing"]]
return = [0,0]
Both rows are ignored because one endpoint is unknown.

Constraints
1 <= names.length <= 2000.
Names are unique, nonempty, and contain no spaces.
0 <= dependencies.length <= 20000.
The graph induced by known names is acyclic.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: reverse the edges so each dependency points to its dependents, then run a DFS or BFS from every node with a visited set. Count the visited nodes minus the start. With n up to 2000 and 20000 edges, that's about 2000 traversals of 22000 steps each, around 44 million operations, which is fine. The pitfall is the naive sum of children's counts. That double counts diamonds, which is exactly what Example 1 tests. Second pitfall: skip rows where either endpoint isn't in names before building the graph, or you'll count phantom nodes (Example 2). Also map names to indices with a hash map and keep output in the original names order. Bitsets per node in topological order are a faster option, but plain traversal is enough. If you freeze on the OA, StealthCoder can supply this approach live while you type.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Unique Transitive Dependent Counts cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Robinhood's OA.

Robinhood reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Unique Transitive Dependent Counts FAQ

What's the trick in the Robinhood unique transitive dependents problem?+

Use a visited set per starting node. Reverse the edges so dependency points to dependent, traverse from each name, and count distinct nodes reached excluding the start. Summing child counts fails because diamond shapes get counted twice.

How hard is this OA really?+

Medium. The algorithm is basic graph traversal, but the dedupe and the filtering of unknown names are where people lose points. If you've written a DFS with a visited set before, you can finish this quickly.

Do I need topological sort here?+

No. The graph is guaranteed acyclic, but a plain DFS or BFS from each node with a visited set works. Topological order with bitsets is an optimization, not a requirement at 2000 nodes and 20000 edges.

What edge cases should I test before submitting?+

Test rows with an unknown endpoint, like Example 2. Test a diamond where one node is reachable by two paths. Also test empty dependencies, which should return all zeros, and duplicate rows, which the visited set handles.

How do I prepare for this in 48 hours?+

Write reachability counting on a directed graph from scratch twice. Build an adjacency list from a name-to-index map, run iterative or recursive DFS with a visited array, and check that output order matches the input names. Then time it on 2000 nodes.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Robinhood.

OA at Robinhood?
Invisible during screen share
Get it