Network Delay Time

Try to solve the Network Delay Time problem.


A network of n nodes labeled 11 to nn is provided along with a list of travel times for directed edges represented as times[i]=(xi, yi, ti)times[i]=(x_i​, \space y_i, \space t_i​), where xix_i​ is the source node, yiy_i​ is the target node, and tit_i​ is the delay time from the source node to the target node.

Considering we have a starting node, k, we have to determine the minimum time required for all the remaining n1n - 1 nodes to receive the signal. Return 1-1 if it’s not possible for all n1n - 1 nodes to receive the signal.


  • 11 \leq k \leq n \leq 100100
  • 11 \leq times.length \leq 60006000
  • times[i].length ==3== 3
  • 1x,y1 \leq x, y \leq n
  • xx !=!= yy
  • 0t1000 \leq t \leq 100
  • Unique pairs of (x,y)(x, y), which means that there should be no multiple edges


Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy