63. Network Delay Time (Dijkstra)
MediumGraphs
Directed edges times[i] = [u, v, w] take w milliseconds. Nodes are labelled 1 to n. A signal starts at node k. Return the time for all nodes to receive it, or -1 if some node never does.
Example 1
Input: times = [[2, 1, 1], [2, 3, 1], [3, 4, 1]], n = 4, k = 2 Output: 2
Constraints
1 ≤ n ≤ 100Weights are non-negative