#C13461. Move Zeros
Move Zeros
Move Zeros
Given an array of integers, your task is to move all the zeros to the end of the array while maintaining the relative order of the non-zero elements. This operation must be performed in-place with a time complexity of \(O(n)\).
Note: The array should be modified without using extra space for another array.
inputFormat
The input is given via standard input (stdin). The first line contains a single integer (n), representing the number of elements in the array. The second line contains (n) space-separated integers.
outputFormat
Output the modified array on a single line, with its elements separated by a single space.## sample
5
0 1 0 3 12
1 3 12 0 0