This one is super easy using python lib


  • 0
    G
    class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        countx=nums.count(val)
        for i in range(0,countx):
            nums.remove(val)
        return len(nums)

Log in to reply
 

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