Subarray Removal
Chef has a **binary** array $A$ of length $N$. In one operation, Chef does the following: **1.** Select any $L$ and $R$ such that $(1 \le L \lt R \le |A|)$ $\\$ **2.** Add $A_L \oplus A_{L+1} \oplus \ldots \oplus A_R$ to his *score* (Here, $\oplus$ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)) $\\$ **3.** Remove the subarray $A_{L \dots R}$ from $A$ D
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