A network has n nodes labelled 1 to n. Each entry [u, v, w] in times is a directed edge: a signal takes w time to travel from u to v.
A signal is sent from node k. Return the time it takes for all nodes to receive it, or -1 if some node never does.
- Weights are positive, so this is Dijkstra's algorithm
- The answer is the largest of the shortest distances
- JavaScript has no built-in priority queue, so a compact
MinHeap keyed on item[0] is already written for you in the starter — write the algorithm, not the plumbing