Problem 3936 · Medium

Minimum Swaps to Move Zeros to End

Zeros must end up in the last slots. Pair each misplaced zero in the front with a misplaced value in the back, one swap per pair.

Open the interactive visualisation