Write a function moveZerosToEnd
that takes an array of int
s and returns a new array with the same
elements as the original, but all zeros are moved to the end while maintaining the order of the non-zero elements.
For example if the array is {0, 1, 0, 3, 12}
, the returned array should be {1, 3, 12, 0, 0}
.
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: