← All problemsSign in

Unique xor

CodeChefRating 1955Open on judge ↗

Given a binary string $S$ of length $N$ and an integer $K$. An operation on the string is defined as: - Select two indices $i$ and $j$ $(i \neq j)$ such that $i \ \% K$ is equal to $j \ \% K$; - Set both $S_i$ and $S_j$ as $S_i\oplus S_j$, where $\oplus$ denotes the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operation. Determine the **minimum** number of operations re

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