My python solution Very simple


  • 0
    L
    class Solution(object):
        def removeElement(self, nums, val):
    
            count = 0
            for x in nums:
                if x == val:
                    count += 1
            for i in range(count):
                nums.remove(val)
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.