Move Zeroes
Question
Example
Hint
Answer
solution:
class Solution(object):
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
z = 0
for i in xrange(len(nums)):
if nums[i]:
nums[z],nums[i]=nums[i],nums[z]
z += 1Knowledge:
Last updated