← All problemsSign in

Journey Of State

All submissions for this problem are available. Abhi lives in a state in which there are N villages and N−1 roads. All the villages are connected via these roads. Each village has been assigned a unique number from 1 to N . The State can be assumed as a tree, with nodes representing the villages and edges representing the roads. The tree is rooted at 1.Every Time, when a traveler through a road,

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