← All problemsSign in

Spike and his Task

Spike the bulldog has some milk bottles and some cheese packets for Tom and Jerry. The milk bottles are denoted by $1$ and the cheese packets by $0$. Spike wants these bottles and the packets to be arranged in an $alternate$ $manner$, i.e. 010101 or 101010. So for this arrangement, he can perform any one of the following 2 operations at a time: - He can swap $any$ two of the things. - He can take

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