【leetcode❤python】27. Remove Element

#-*- coding: UTF-8 -*-
class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        for i in range(len(nums)-1,-1,-1):
            if nums[i]==val:
                del nums[i]
        
        return len(nums)
    
sol=Solution()
print sol.removeElement([3,2,2,3], 3)

上一篇:leetcode 191


下一篇:Async分析