Created
October 26, 2024 21:59
-
-
Save hongtaoh/cf5cdf798c49ee71c31a5af4057f2a11 to your computer and use it in GitHub Desktop.
Solution to Leetcode 283
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def moveZeroes(self, nums: List[int]) -> None: | |
""" | |
Do not return anything, modify nums in-place instead. | |
""" | |
l = 0 | |
for r in range(len(nums)): | |
if nums[r] != 0: | |
nums[l], nums[r]= nums[r], nums[l] | |
l += 1 | |
return nums |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment