-
Notifications
You must be signed in to change notification settings - Fork 0
LC 0283 [E] Move Zeroes
Code with Senpai edited this page May 31, 2022
·
2 revisions
we want the 0s to the right
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
z = 0
for i in range(len(nums)):
if nums[i] != 0:
nums[i], nums[z] = nums[z], nums[i]
z += 1
return nums
footer