Network Delay Time

Try to solve the Network Delay Time problem.

Statement

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 n−1n - 1 nodes to receive the signal. Return −1-1 if it’s not possible for all n−1n - 1 nodes to receive the signal.

Constraints:

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

Examples

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

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