← All problemsSign in

Alternate It!

CodeChefRating 1789Open on judge ↗

Given a binary string $S$. You can perform a series of operations on it any number of times: - Odd-numbered operations $(1^{st}, 3^{rd}, 5^{th}, ...):$ You can shuffle any (possibly empty) substring$^{\dagger}$ of $S$ in any order. - Even-numbered operations $(2^{nd}, 4^{th}, 6^{th}, ...)$ : You can choose any (possibly empty) substring of $S$ and *fl

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