← All problemsSign in

Friendship

Problem description. In a College there are N people and there are M friendships between them Friendships are transitive , i.e if A is friend of B and B is friend of C then A and C are also friends. All people who are friends to each other forms a "Group". Your task is simple, you need to find out Number of Groups and size of each group. Input Input description. - The first line contains

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