===== 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]:
    write = 0
    for read in range(len(nums)):
        if nums[read] != 0:
            nums[write] = nums[read]
            write += 1

    for i in range(write, len(nums)):
        nums[i] = 0

    return nums
```