Maximum XOR
You are given an array $A$ of length $N$. You can do the following operation on the array **atmost once**: - Choose any **non-negative** integer $X$ and a subarray $[L, R]$ $(1 \leq L \leq R \leq N)$ and update $A_i = A_i \& X$ for all $L \leq i \leq R$. Here $\&$ denotes [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) operation. Find the **maximum** [bitwise XOR](https://en.
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