← All problemsSign in

Graphical Friendship

Manu and Aditya are very good friends and they both love playing with graphs. One day, one of their friend Arvind got a very interesting problem for them. Since all three of them are busy in the preparation of $CCDSAP$ exam, they have invited you to solve it. A graph with $N$ vertices and $M$ edges are given. $Null$ $parent$ is the vertex which has no parent but may have $0$ or more children. In

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