Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def removeElement(self, nums: List[int], val: int) -> int:
- val_till_now = 0
- for index, num in enumerate(nums):
- if num == val:
- val_till_now += 1
- else:
- nums[index-val_till_now] = nums[index]
- return len(nums) - val_till_now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement