Minimize bottleneck path
Your task
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.
Examples
min_bottleneck(n: int, edges: list[list[int]], s: int, t: int) -> intExample 1
Input
min_bottleneck(4, [[0, 1, 4], [1, 3, 4], [0, 2, 2], [2, 3, 3]], 0, 3)Output
3