Not Tree Again!
You are given a [tree](https://en.wikipedia.org/wiki/Tree_(graph_theory)) with $N$ nodes rooted at node $1$. The $i^{th}$ node of the tree has a value $A_i$ assigned to it. For the $i^{th}$ node $(1\le i \le N)$, output the **minimum** value of [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of the **values** of any two **distinct** nodes in the subtree of node $i$. Formall
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.
Sign in to chat with the tutor and save your progress.
Sign in to start