class Solution(object):
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
for i in range(0, len(nums)):
if val in nums:
nums.remove(val)
return len(nums)
Leetcode_27 移除元素小白解法
最新推荐文章于 2024-06-22 22:59:06 发布