Binary OP
Chef has a binary string $S$ of length $N$. He can perform the following operation on string $S$: - Select a substring of size $M$ and flip all the characters of the selected substring, i.e., change $0$ to $1$ and $1$ to $0$. There are $Q$ queries of the following $2$ types: - $0$: Append $0$ to the front of string $S$. - $1$: Append $1$ to the front of string $S$. After each query, find the
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