BackmediumUncategorized uncategorized medium

Min Delay Path Finder Solution

Problem Statement

Given a weighted graph represented as an adjacency list where each node has a unique delay, find the minimum total delay path from a given start node to a destination node. The graph is represented as a list of edges where each edge is a tuple of (source node, destination node, delay). The start node and destination node are represented as integers.

Example 1
Input
[[(0, 1, 2), (0, 2, 3), (1, 3, 1), (2, 3, 2)], 0, 3]
Output
3

Explanation: The minimum total delay path is 0 -> 1 -> 3 with a total delay of 2 + 1 = 3.

Constraints

  • 1 <= number of nodes <= 100
  • 1 <= number of edges <= 500
  • 0 <= delay <= 1000
  • start node and destination node are valid nodes in the graph
  • the graph does not contain any negative cycles
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free