===== ISTEM =====
Solve the following programming task.

TASK: Move Zeroes to the End

Write a function 'move_zeroes(nums)' that moves all 0s in an integer list to the end while preserving the relative order of the non-zero elements, updating the same list in place.

STARTER CODE (python):
def move_zeroes(nums: list[int]) -> list[int]:
    # Write your code here
    pass


RULES:
- Keep the function name and signature EXACTLY as given.
- Return working code only. No explanations.
- Put the code in a single ``` block.
- Try to solve it first. If you genuinely cannot, write only this single
  line instead of producing faulty code: CANNOT_SOLVE

===== HAM YANIT =====
```python
def move_zeroes(nums: list[int]) -> list[int]:
    # Two-pointer approach
    non_zero_idx = 0
    for i in range(len(nums)):
        if nums[i] != 0:
            nums[non_zero_idx] = nums[i]
            non_zero_idx += 1
    # Fill the rest with zeros
    for i in range(non_zero_idx, len(nums)):
        nums[i] = 0
    return nums
```