Given an integer array nums, move all 0 values to the end of the array while preserving the relative order of the non-zero elements. Modify the array in place and return the resulting array.
Example 1:
Input: nums = [0, 1, 0, 3, 12]
Output: [1, 3, 12, 0, 0]
Explanation: The non-zero values keep their original order, and both zeros are moved to the end.
Example 2:
Input: nums = [0, 0, 1]
Output: [1, 0, 0]
Explanation: The single non-zero element stays first, and the zeros are shifted to the back.
1 <= nums.length <= 10^5-2^31 <= nums[i] <= 2^31 - 1