Skip to main content

Network Delay Time

Given n nodes (1 to n), times array [u, v, w] (edge from u to v with weight w) and starting node k, find minimum time for all nodes to receive signal Return -1 if impossible Example: n = 4, times = [[2,1,1],[2,3,1],[3,4,1]], k = 2 => 2

This one rewards reaching for a priority queue instead of repeatedly sorting or scanning. Interviewers love it because it reveals your priority-based reasoning and your edge-case discipline. The trap is stale entries or unbalanced structures—be clear about what belongs in the heap.

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.

1Calculate Network Delay Timemedium
Based onLeetCode

Get a note when something new lands

New company guides, new problems and big changes to Coco. Rare, and you can leave any time. By joining you agree to get these emails.