Move zeroes

Write codeEasy15 minMeta style

Your task

Given an integer array, move all 0s to the end while keeping the relative order of the non-zero elements, and return the result. Aim to do it with a single pass and constant extra space. The array has length >= 1.

Examples

move_zeroes(nums: list[int]) -> list[int]
Example 1
Inputmove_zeroes([0, 1, 0, 3, 12])
Output[1, 3, 12, 0, 0]