Code RoomWidest path in graph
HardPrep Room Coding #828

Widest path in graph

CodingAlgorithms & data structuresSenior–Staff~40 min

Given an undirected weighted graph with n nodes (0..n-1) and edges [u, v, w] with positive capacities w, find a path from a source to a destination that maximizes the minimum edge capacity along the path (the widest path / bottleneck). Return that maximum bottleneck value, or -1 if the destination is unreachable. If source equals destination, return 0. Constraints: 1 <= n <= 500.

Implement
max_bottleneck_path(n: int, edges: list[list[int]], src: int, dst: int) → int
Examples
in[3,[[0,1,1],[1,2,5],[0,2,3]],0,2]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 40 min
InputExpectedGot
[3,[[0,1,1],[1,2,5],[0,2,3]],0,2]3not run yetsample