Stupid Python solution


  • 0
    S
    class Solution(object):
        def moveZeroes(self, nums):
            cnt = 0
            for seq in range(len(nums)):
                if nums[seq] != 0 and cnt != 0:
                    nums[seq - cnt] = nums[seq]
                    nums[seq] = 0
                elif nums[seq] == 0:
                    cnt += 1
    

Log in to reply
 

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