293. Network Delay Time

MediumGraph

You are given a network of n nodes, and times array. Return the minimum time for all nodes to receive signal from node k. Return -1 if not all nodes are reachable.

Examples

Input: [[1,2,2],[1,3,5],[2,3,1],[2,4,4],[3,4,2],[4,5,3],[3,5,7]] 5 1

Output: 8

Explanation: Public test case for Network Delay Time

Constraints

  • 1 <= n <= 100
  • 1 <= times.length <= 6000
Loading...

Run checks all cases above. Submit evaluates all test cases.