Sweep the Zeroes (Arrays & Lists)
Move every 0 in the list to the end while keeping the other values in their original order. Change the list in place, then the judge prints it.
Input: n (1 to 1000), then n integers.
Output: The list, space-separated.
Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Keep a write position: copy each non-zero value there and step forward.