-
Notifications
You must be signed in to change notification settings - Fork 0
LC 0027 [E] Remove Element
Code with Senpai edited this page May 31, 2022
·
1 revision
like move zeroes, we want the vals to the right
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
z = 0
for i in range(len(nums)):
if nums[i] != val:
nums[i], nums[z] = nums[z], nums[i]
z += 1
return z
footer