Xor Equation
You are given an array $A$ of $N$ non-negative integers, where $N$ is odd. Find the minimum non-negative integer $x$ that satisfies the equation $$(A_1 + x) \oplus (A_2 + x) \oplus \dots \oplus (A_N + x) = 0$$ where $\oplus$ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). If no such $x$ exists, print $-1$. **Note:** The input of this problem is large, s
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