← All problemsSign in

Connected Components

Given a undirected graph find the number of connected components. Input First line of the input is 't'- number of test case. Followed by N, the number of vertices (Numbered 0 to N-1). Followed by 'e' number of edges. Followed by description of 'e' edges in the form 'a b' I.e. an edge exist between vertex a and b. Constraints: T=10 2 Output One line per test case, number of connected componen

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start