Add Remove Element
This commit is contained in:
parent
046a2c87e9
commit
707e68cf0a
8
python/remove_element.py
Normal file
8
python/remove_element.py
Normal file
@ -0,0 +1,8 @@
|
||||
class Solution:
|
||||
def removeElement(self, nums: List[int], val: int) -> int:
|
||||
n = len(nums)
|
||||
for i in range(n-1, -1, -1):
|
||||
if nums[i] == val:
|
||||
del nums[i]
|
||||
n -= 1
|
||||
return n
|
Loading…
Reference in New Issue
Block a user