← All problemsSign in

Modak Tree

Given a tree with $N$ nodes, you need to respond to $Q$ queries of two types: **Type 1:** When provided with node $X$ as input, update the value of the $Xth$ node to value $V$. **Type 2:** When provided with node $X$ as input, calculate the absolute difference between the $XOR$ and $OR$ operations for all node values in the subtree of node $X$, including node $X$. i.e. $|XOR(subtree(x)) - OR(su

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