DEV Community

Victor Joseph
Victor Joseph

Posted on

Remove Element

class Solution: def removeElement(self, nums: List[int], val: int) -> int: while val in nums: nums.remove(val) 
Enter fullscreen mode Exit fullscreen mode

Day 2 of 10. Leet code problem can be found here

I looped through the entire array while checking if the val is in the array. if it is found, i remove that particular value.

tada :)

Top comments (0)