Move Zeroes to End
easy⏱ 15 mintypescriptchallengesproblem-solving-basic-
Caso de ejemplo — tu programa lee de stdin e imprime en stdout.
Given an array of integers, move all zeroes to the end while maintaining the relative order of non-zero elements.
Use two pointers: one for the position to insert non-zero, one to scan.
Example: [0,1,0,3,12] → [1,3,12,0,0]
Formato de entrada
Line 1: n. Line 2: n space-separated integers.
Formato de salida
The array with zeroes moved to end, space-separated.
Restricciones
1 ≤ n ≤ 10⁴