← All problemsSign in

Tree Sum is Fun !

CodeChefRating 2222Open on judge ↗

You're given an infinite binary tree called $\textbf{Funny Tree}$. This tree has one vertex labeled with every positive integer, and the children of the vertex labeled $i$ are the vertices labeled $2i$ and $2i+1$. The first $15$ nodes of the tree are depicted in the image below. MathModel selects a node $u$ and an integer $N$. Starting from node $u$, MathModel will repeatedly move to the parent n

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