标签:leetcode pass class elf one return sel anything list
双指针
class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ i = j = 0 while j < len(nums): if nums[j] == 0: pass else: nums[i] = nums[j] i += 1 j += 1 while i < len(nums): nums[i] = 0 i += 1
标签:leetcode pass class elf one return sel anything list
原文地址:https://www.cnblogs.com/lautsie/p/12246729.html