← All problemsSign in

Sort The Magic Ball

Admin has n magic ball. All **n** magic balls are placed in a stand, and the **i-th** magic ball printed with number **a[i]**. Each magic ball ability  to change its color between black and white. In the beginning, the color of each of ball is white. Admin can perform some actions on ball. On each action , Admin can select two neighboring magic ball and swap them. After performing each action, th

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