Paytm Payment Network Delay Dijkstra
Paytm Payment Network Delay Dijkstra
MediumGraphs100% accepted
Paytm payment nodes are connected with directed weighted edges representing latency. Given n nodes, edges [u,v,w], and source k, find the minimum time for signal to reach all nodes from k. Return -1 if any node is unreachable.
Approach
Single-source shortest path with weighted directed graph (Dijkstra).
Input
4 4 2
2 1 1
2 3 1
3 4 1
1 4 3
Output
2
More Graphs problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards