Code RoomWidest path capacity
HardPrep Room Coding #1043

Widest path capacity

CodingAlgorithms & data structuresSenior~30 min

Given a connected undirected graph with n nodes (0..n-1) and edges [u, v, w] where w (a positive integer) is the bandwidth/capacity of that link, return the maximum-bottleneck (widest) path capacity from src to dst: among all paths, the maximum over paths of the minimum edge weight along the path. Return -1 if dst is unreachable from src. You may assume src != dst. Assume 1 <= n <= 5000.

Implement
max_bottleneck_path(n: int, edges: list[list[int]], src: int, dst: int) → int
Examples
in[4,[[0,1,4],[1,3,2],[0,2,3],[2,3,3]],0,3]out3
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.

0:00 of about 30 min
InputExpectedGot
[4,[[0,1,4],[1,3,2],[0,2,3],[2,3,3]],0,3]3not run yetsample