← All problemsSign in

Non Zero Xor

CodeChefRating 1975Open on judge ↗

An array $A$ of size $N$ is called *good* if the following conditions hold: - For every pair $(l, r)$ $(1 \le l \le r \le N)$, $A_l \oplus A_{l+1} \oplus ... \oplus A_{r} \ne 0$. (where $\oplus$ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).) JJ has an array $A$ of size $N$. He wants to convert the array to a good array. To do so he can perform the follo

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