Data Structures & AlgorithmsVery hardICPC regional · Product Company SDE

Problem: A graph on vertices 0–6 has edges 0-1, 0-2, 1-3, 2-3, 3-4, 4-5, 5-6, 4-6. Count the bridges (edges whose removal increases the number of connected components).

  1. A. 2
  2. B. 0
  3. C. 3
  4. D. 1

Correct answer: D. 1

An edge is a bridge exactly when it lies on no cycle. Edges inside the 4-cycle 0-1-3-2 and the triangle 4-5-6 are not bridges, so only the connecting edge qualifies.

More Coding Interview Problems questions

Exams that ask this topic