O(n) 4lins Python solution

  • 0
    class Solution(object):
        def moveZeroes(self, nums):
            :type nums: List[int]
            :rtype: void Do not return anything, modify nums in-place instead.
            for i in range(len(nums)-1, -1, -1):
                if nums[i] == 0:
                    del nums[i]

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.