← All problemsSign in

Three Wise Men

Ed, Edd, and Eddy have abducted Plank, Johnny’s best friend (who is actually a piece of wood). Eddy demands money for returning Plank but since Johnny had no money, Edd being the smarter one decided to let go of Plank if he could answer all their questions. Edd gives a tree with $n$ nodes and each node has a value $a_i$ associated with it, they give him $q$ queries. Each of them asks a parti

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