← All problemsSign in

Binary String Xor

CodeChefRating 1943Open on judge ↗

Chef has a binary string $S$ of length $N$. He wonders if it is possible to divide $S$ into exactly $K$ non-empty [substrings](https://en.wikipedia.org/wiki/Substring) such that each $S_i$ belongs to exactly one substring and the $\texttt{XOR}$ of each substring is the same. Can you help Chef to determine if it is possible to do so? Note: $\texttt{XOR}$ of substring $S_{L \cdots R}$ is defined as

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