Data Structures & AlgorithmsHardICPC regional · Product Company SDE

Problem: In a directed graph with arcs 0→1, 1→2, 2→0, 2→3, 3→4, 4→3, the strongly connected components are formed. What is the size of the largest strongly connected component?

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

Correct answer: B. 3

Two vertices share a strongly connected component when each can reach the other. The cycle 0-1-2 forms one component of size three, and 3 and 4 form a separate component.

More Coding Interview Problems questions

Exams that ask this topic