Flip or Reverse
You are given a binary string $A$ and want to convert it to another binary string $B$. Both have lengths $N$. You can do either of the following operations at most $\lceil \frac{N}{2} \rceil$ times: - **Type $1$**: Choose $(L, R)$ such that $1 \le L \le R \le N$, and flip $A_i$ for each $L \le i \le R$. To flip $X$ means to replace it with $1 - X$. - **Type $2$**: Choose $(L, R)$ such that $1 \
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