Data Structures & AlgorithmsHardProduct Company SDE · ICPC regional

Problem: A bottleneck path from vertex 0 to vertex 4 minimises the largest edge weight used. Using the undirected edges 0-1 (7), 1-2 (3), 2-4 (9), 0-3 (4), 3-2 (6), 3-4 (8), what is the minimum possible value of the largest edge on a 0→4 path?

  1. A. 12
  2. B. 8
  3. C. 9
  4. D. 4

Correct answer: B. 8

Sort edges and add them until 0 and 4 connect (or read the MST path): 0-3-4 uses edges 4 and 8, so the bottleneck is 8. The shortest-sum view of the same path gives 12, routes through vertex 2 must use the 9-edge, and maximising the smallest edge instead (widest-path confusion) gives 4.

More Coding Interview Problems questions

Exams that ask this topic