Practice Minimum Time to Reach Destination in Directed Graph
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Time to Reach Destination in Directed Graph
Problem Statement
Start at node 0 at time zero in a directed graph. An edge [u, v, start, end] may be entered only at an integer time in the inclusive interval [start, end], and traversing it takes one time unit. You may instead wait one time unit at your current node. Return the earliest arrival time at node n - 1, or -1 if unreachable.
Source: Minimum Time to Reach Destination in Directed Graph on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 3, edges = [[0,1,0,1],[1,2,2,5]]
3
# Example 2
n = 4, edges = [[0,1,0,3],[1,3,7,8],[0,2,1,5],[2,3,4,7]]
5
# Example 3
n = 3, edges = [[1,0,1,3],[1,2,3,5]]
-1
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Time to Reach Destination in Directed Graph.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.