Network Delay Time
Try to solve the Network Delay Time problem.
We'll cover the following
Statement#
A network of n nodes labeled to is provided along with a list of travel times for directed edges represented as , where is the source node, is the target node, and 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 nodes to receive the signal. Return if it’s not possible for all nodes to receive the signal.
Constraints:
-
kn -
times.length times[i].length-
n - Unique pairs of , which means that there should be no multiple edges
Examples#
1 of 3
2 of 3
3 of 3
Understand the problem#
Let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Network Delay Time
What is the minimum time it takes for all the n nodes to receive the signal?
times = [[3, 1, 1], [2, 3, 1], [2, 4, 1]]
n = 4
k = 2
1
2
3
-1
Figure it out!#
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Try it yourself#
Implement your solution in the following coding playground.
Graphs: Introduction
Solution: Network Delay Time