Practice · 3 of 6
Move zeros in place
CHALLENGE
Difficulty: intermediate+25 XP
Implement void moveZeros(int[] arr): all zeros to the end, in place, preserving non-zero order. Two passes: compact non-zeros forward with a write index, then zero-fill the tail.
Press Submit to check your solution.
Back to lesson: Practice: Array lab