Algorithm/LeetCode 문제 풀이

[LeetCode 283] python 리스트(큐/스택) 이용하기

공놀이나하여보세 2019. 4. 2. 06:47

파이썬은 리스트가 잘 되어 있어서 구현이 쉬웠음

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