Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array.
Example 1
Input: nums = [0,1,0,3,12]
Output: [1,3,12,0,0]
Explanation: The non-zero values 1, 3 and 12 keep their order and shift to the front, and the two zeros fill the end.
Example 2
Input: nums = [0]
Output: [0]
Explanation: The array holds a single zero, so it stays as it is.
Example 3
Input: nums = [1,2,3]
Output: [1,2,3]
Explanation: There are no zeros to move, so the array is unchanged.
Use a slow pointer to track the position for the next non-zero element. Fast pointer scans through the array.
Run checks all cases above. Submit evaluates all test cases.