Code Room
CodingMediumcod-g700
Subject Dijkstra variantsLevel Mid–Senior~30 minCommon in Algorithms & data structures interviewsIndustries Software development, Telecom

Question

An undirected network on n nodes (0..n-1) has links given as [u, v, c] where c is the link's bandwidth. The bandwidth of a path is its smallest link. Return the maximum-bandwidth (widest) path value from s to t, or -1 if t is unreachable. Constraints: 1 <= n <= 10^4; 1 <= c <= 10^9.

Implement
widest_path(n: int, edges: list[list[int]], s: int, t: int) → int
Examples
in[4,[[0,1,3],[1,3,2],[0,2,4],[2,3,5]],0,3]out4
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.