Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Network Delay Time (Dijkstra)

Medium Graphs

A directed weighted network has n nodes labelled 1..n. A signal is sent from node k. Print the minimum time for all nodes to receive it, or -1 if some node can never receive it.

Constraints

1 <= k <= n <= 100 1 <= m <= 6000 0 <= w <= 100

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.