Move the Coins - Creating Tests
Chef is preparing tests for the problem ["Move the Coins"](https://www.hackerrank.com/challenges/move-the-coins/problem)! He needs to create a tree $G$ with $N$ nodes (numbered $1$ through $N$), which is rooted at node $1$, and a list of $Q$ distinct *reparentings*. A reparenting is a pair of nodes $(u, v)$ ($u \neq 1$) of $G$ and the result of applying it to $G$ is another graph, formed as fol
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.
Sign in to chat with the tutor and save your progress.
Sign in to start