← All problemsSign in

Is this DP on trees!!

One day $Pk$ visited a weird country which was of the form fully Complete Binary tree , $Pk$ has $K$ amount of Money, the Nodes that are at same distance from the root node forms a $City$, where each node in the city is considered as a $shop$, $Pk$ should always $start$ from the $root$ node and descend down the tree ( go to each city ) . He can always Buy from the $contiguous$ shops only and

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