Build the PrimitiveMedium
Network Delay Time
Write `network_delay_time(times, n, k)` where each `[u, v, w]` is a directed edge with delay `w`, nodes are `1..n`, and the signal starts at `k`. Return the time for all nodes to receive it, or `-1` if some never do.
times = [[2,1,1],[2,3,1],[3,4,1]], n = 4, k = 2 -> 2
BFS finds the fewest *hops*, which is not the smallest total weight — a two-hop path can be cheaper than a one-hop path. Dijkstra with a min-heap always finalises the nearest unfinalised node. Be ready to say it breaks on negative weights and why.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.