← All problemsSign in

ATTRACTIVE TREE

You are given a tree of $N$ nodes rooted at Node 0. The root is present at 0 height. Its children are at 1 height, their children at 2 and so on..... Each node of a given tree has a $value$ $A$ associated with it. Nodes at height 0 have value $A$ = 0, Nodes at height 1 have value $A$ = 1, and so on. You are given a similar tree where each node has a value $B$. All leaves are assig

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