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

Question

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) → int
Examples
in[4,[[0,1,4],[1,3,4],[0,2,2],[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.

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.