#-*- 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)
相关文章
- 02-24Leetcode027. Remove Element
- 02-24[leetcode]Remove Duplicates from Sorted Array II @ Python
- 02-24【leetcode❤python】169. Majority Element
- 02-24[LeetCode&Python] Problem 27. Remove Element
- 02-2427. Remove Element(js)
- 02-24【LeetCode】1047. Remove All Adjacent Duplicates In String 解题报告(Python)
- 02-24【leetcode❤python】83. Remove Duplicates from Sorted List
- 02-24【leetcode❤python】 19. Remove Nth Node From End of List
- 02-24【leetcode❤python】26. Remove Duplicates from Sorted Array
- 02-24【leetcode❤python】27. Remove Element