MEDIUMasked at 2 companies

Network Delay Time

A medium-tier problem at 57% community acceptance, tagged with Depth-First Search, Breadth-First Search, Graph. Reported in interviews at Akuna Capital and 1 others.

Founder's read

Network Delay Time is the graph shortest-path problem that shows up at Netflix and Akuna Capital. You're given a directed graph and a source node, and you need to find the time it takes for a signal to reach all nodes. The trap: thinking this is just a simple BFS or DFS traversal. It's not. The graph has weighted edges, and you need the longest shortest path from the source. Half the candidates who see this problem in their OA either miss the weighted-graph requirement or implement Dijkstra's wrong. If you blank on the algorithm, StealthCoder solves it invisibly and surfaces a working solution in seconds.

Companies asking
2
Difficulty
MEDIUM
Acceptance
57%

Companies that ask "Network Delay Time"

If this hits your live OA

Network Delay Time is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The key insight is that this is a single-source shortest path problem. You can't use plain BFS because edge weights matter. Dijkstra's algorithm with a min-heap is the standard play: pop the minimum-distance node, relax its neighbors, repeat until the priority queue is empty. The final answer is the maximum distance among all reachable nodes. A common pitfall is forgetting to check if all nodes were reached (if some are unreachable, return -1). Another mistake is using Bellman-Ford when Dijkstra works fine on non-negative weights. The problem tests whether you recognize graph structure, know the shortest-path toolkit, and can implement a heap-based priority queue correctly. When the OA timer is ticking and you're unsure whether to use BFS, DFS, or Dijkstra, StealthCoder removes the guesswork and delivers a correct implementation.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Network Delay Time recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Network Delay Time interview FAQ

Is this problem really a Medium or is it harder?+

The problem is Medium difficulty in algorithmic complexity, but the acceptance rate of 57% suggests many candidates struggle in live settings. The trick is recognizing weighted edges and knowing Dijkstra's algorithm. If you've drilled shortest-path problems, it's straightforward. If not, it feels hard under OA pressure.

Do I need to implement Dijkstra's from scratch?+

Yes. Most online assessments don't allow you to import a graph library that does Dijkstra for you. You need a priority queue (min-heap), a distance array, and the core algorithm. Python's heapq module is fair game. The implementation is short but easy to botch under time pressure.

What if some nodes are unreachable?+

Return -1. This is the edge case that catches candidates. After Dijkstra runs, check whether all nodes have been visited. If any node's distance is still infinity, the signal never reaches it, so the answer is -1.

Can I use BFS instead of Dijkstra's?+

No. BFS works for unweighted graphs. Since edges have weights (delays), you must use Dijkstra's or Bellman-Ford. BFS will give you the wrong answer on any test case with non-uniform edge weights.

How does this relate to the other graph topics listed?+

DFS and BFS are foundational graph traversal techniques, but they don't handle weights. This problem requires you to step up to Heap and Shortest Path algorithms. It's the bridge between basic graph problems and optimization-focused ones.

Want the actual problem statement? View "Network Delay Time" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.