Reported September 2026
OpenAIgraph

Network Endpoint or Cycle Boundary

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

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

The OpenAI OA reported in September 2026 looks like a graph problem, but the real test is whether you handle the cycle case without looping forever. You get a directed network where every node has at most one outgoing edge, and you walk from a start node until you hit a dead end or would step onto a node you've already seen. Most people nail example one and then hang on example two. If you've got an invite and 48 hours, this is a ten-minute problem once you see it. StealthCoder is the safety net if your mind goes blank mid-assessment.

The problem

You are given a directed network with n nodes numbered from 0 to n - 1. Each pair [from, to] in edges creates one directed edge from from to to. Every node has at most one outgoing edge.
Start at start and repeatedly follow the current node's outgoing edge.
If the current node has no outgoing edge, return that endpoint.
If following the next edge would revisit any node already seen on this walk, return the current node. It is the last node visited before the walk would repeat.

Function
findNetworkResult(n: int, edges: int[][], start: int) → int

Examples
Example 1
n = 10
edges = [[1,3],[7,3],[3,4],[4,6],[2,6],[6,9],[9,5]]
start = 1
return = 5
The walk is 1 → 3 → 4 → 6 → 9 → 5. Node 5 has no outgoing edge.
Example 2
n = 5
edges = [[0,1],[1,2],[2,3],[3,1]]
start = 0
return = 3
The next edge from node 3 leads to the already visited node 1, so return 3.
Example 3
n = 6
edges = [[0,2],[2,4]]
start = 5
return = 5
The starting node already has no outgoing edge.

Constraints
1 ≤ n ≤ 200000
0 ≤ edges.length ≤ n
Every edge contains two node labels in [0, n - 1].
No node appears as from more than once.
0 &le; start < n

Reported by candidates. Source: FastPrep

Pattern and pitfall

Because each node has at most one outgoing edge, store edges in an array of size n filled with -1. Then simulate the walk with a visited set or boolean array. At each step, check the next node. If it's -1, return the current node. If the next node is already visited, return the current node. Otherwise mark it visited and move. That's O(n) time and O(n) space, and the walk can never exceed n steps. The common pitfall is checking visited after you move, which returns the repeated node instead of the last one before the repeat. Another trap is forgetting that start itself can be a dead end, as in example three. Don't build an adjacency list of lists, it's wasted work. If you freeze on the order of checks during the live OA, StealthCoder can give you the clean loop as a hedge.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Network Endpoint or Cycle Boundary 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

OpenAI reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Network Endpoint or Cycle Boundary FAQ

How hard is the OpenAI Network Endpoint or Cycle Boundary problem really?+

Easy once you spot the structure. One outgoing edge per node means you just simulate a walk. The difficulty is the cycle boundary, returning the last node before a repeat. If you track visited nodes and check before moving, it's short and clean.

What's the trick to avoid an infinite loop?+

Mark each node visited as you step onto it, starting with start. Before moving, look at the next node. If it's already visited, return the current node. The walk is bounded by n nodes, so it always terminates.

Do I need DFS or a full graph traversal?+

No. With at most one outgoing edge per node, there's no branching. A plain loop with a next-node array does the job. Writing recursive DFS risks stack overflow at n up to 200000, so iterate.

What edge cases should I test before submitting?+

Test a start node with no outgoing edge, an empty edge list, a self-loop like [3,3], and a cycle that doesn't include start, like example two. Self-loops should return the current node since the next step repeats it.

How do I prepare for this in 48 hours?+

Write the solution from scratch twice using an array of next pointers and a visited array. Then trace all three examples by hand. Spend the remaining time on other linked-list-style and cycle detection problems so the pattern feels automatic.

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

OA at OpenAI?
Invisible during screen share
Get it