Python beat 100% fast solution


  • 1
    N
    def moveZeroes(self, nums):
            # move all non-zero number to the left
            i, l = 0, 0
            while i < len(nums):
                if nums[i] != 0:
                    nums[i], nums[l] = nums[l], nums[i]
                    l += 1
                i += 1
    

Log in to reply
 

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