Escape the Tree
Chef is trying to make his birthday party adventurous. He recently heard about *escape the room* games, so he wants to prepare his own version of such a game. First, Chef will lock his friends in the root of a full binary tree with depth $h$, i.e. with $2^{h+1}-1$ nodes (numbered $1$ through $2^{h+1}-1$). The root has number $1$, but the other nodes may be numbered arbitrarily. His friends can
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