← All problemsSign in

S to T

CodeChefRating 1640Open on judge ↗

You are given $2$ binary strings $S$ and $T$, of length $N$. Here, binary strings means both $S$ and $T$ contain only $0$s and $1$s. Is it possible to make $S$ equal to $T$ using at most $3 \cdot N$ such operations: - Choose $1 \le i < N$ such that $S_i = 1$ and then flip $S_{i + 1}$, i.e. change it from $0$ to $1$ or $1$ to $0$. If it is possible, please print an operation sequence. If it is i

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