Bootstrap

LEETCODE 27.Remove Element

class Solution:
    def removeElement(self, nums: List[int], val: int) -> int:
        pre=0
        while pre<len(nums):
            if nums[pre]==val:
                nums.pop(pre)
            else:
                pre+=1
        return len(nums)

 

;