You are given a network of n nodes labeled 1 to n. You are also given times, a list of travel times as directed edges times[i] = (u, v, w) where u is the source, v is the target, and w is the time. We send a signal from node k. Return the minimum time for all n nodes to receive the signal. If impossible, return -1.
times = [[2,1,1],[2,3,1],[3,4,1]], n = 4, k = 22times = [[1,2,1]], n = 2, k = 11times = [[1,2,1]], n = 2, k = 2-1Greedy: always process closest unvisited node. Relaxation: if dist[u]+w<dist[v], update. Max dist = time for last node to receive signal.