Stamps 100
You are given a **binary** string $S$ of length $N$. You can apply the following operation any (possibly zero) number of times: - Select an integer $i\ \lparen 1 \leq i \leq N-2 \rparen$ and replace the substring $S_i S_{i+1} S_{i+2}$ with `100`. Find the **lexicographically smallest** string after the operations. Note: String $X$ is lexicographically smaller than string $Y$ if $X_i \lt Y_i$, w
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