Arrays easy time O(n) space O(1)
Move Zeroes
Keep a write pointer for the next non-zero slot. Scan the array; each non-zero value swaps down to that slot. Zeros naturally collect at the back, order preserved.
Write pointer w marks the next slot for a non-zero value.
1 / 9
Practice
Machine twin: /dsa-viz-v2/move-zeroes.json — the full deterministic run as structured data.