
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 - 1nums = [0, 1, 0, 3, 12]Output[1, 3, 12, 0, 0]WhyThe non-zero elements `1, 3, 12` remain in order, and the zeros move to the end.nums = [0, 0, 1]Output[1, 0, 0]WhyOnly one non-zero element exists, so it moves to the front and the remaining positions become zero.nums = [4, 2, 1]Output[4, 2, 1]WhyThere are no zeros, so the array remains unchanged.1 <= nums.length <= 10^5-2^31 <= nums[i] <= 2^31 - 1The relative order of non-zero elements must be preservedModify the array in placedef move_zeroes(nums):