Minimize bottleneck path
You are given an undirected weighted graph on n nodes as edges [u, v, w] with positive integer weights (think of w as a link's congestion), plus a source s and target t. Among all paths from s to t, find one that minimizes its maximum edge weight, and return that minimized maximum (the bottleneck). Return -1 if t is unreachable. Constraints: up to 60 nodes; parallel edges allowed.
Implement
min_bottleneck(n: int, edges: list[list[int]], s: int, t: int) → intExamples
in
[4,[[0,1,4],[1,3,4],[0,2,2],[2,3,3]],0,3]out3What 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
solution.py
InputExpectedGot
[4,[[0,1,4],[1,3,4],[0,2,2],[2,3,3]],0,3]3not run yetsample