class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ count = 0 for n in nums[:]: if n == 0: nums.remove(0) count += 1 nums += *count
But I'm not sure whether use nums[:] was making a copy of array or not . Can anyone explain it a little bit?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.