← All problemsSign in

Teaming Up

The professor wants to divide the class of n students into two groups Left (L) and Right(R) for some project work. But the students are very talkative and so the professor decides that no two friends should fall into the same group. Each student is recognized by his index which is in the range of 1 to n. The professor knows through unknown sources who are friends with whom. So he has asked you to

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