In a Meta-style feed processing task, you are given a list of integers and need to shift all non-zero values to the left side of the list while keeping their original relative order. All zeros should be moved to the right.
Write a function that modifies the list in place and returns it.
numsExample 1
nums = [0, 1, 0, 3, 12][1, 3, 12, 0, 0]1, 3, and 12 stay in the same order and are compacted to the left.Example 2
nums = [4, 0, 5, 0, 0, 2][4, 5, 2, 0, 0, 0]1 <= len(nums) <= 10^5-10^9 <= nums[i] <= 10^9