Binary Removals
Given a **binary** string $S$ of length $N$, and two integers $X$ and $K$. Your task is to empty the string by performing the following operation : - In one operation, you may select any subsequence$^{\dagger}$ of the string such that the number of **inversions**$^{\dagger}$ in the subsequence lies in the range $[0, X]$ and is divisible by $K$. - Remove the selected subsequence from the string.
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