Easily Understandable Python Code


  • 0
    M

    class Solution(object):
    def removeElement(self, nums, val):
    start,end = 0,len(nums)
    while start<end:
    if nums[start] == val:
    del nums[start]
    end-=1
    else:
    start+=1
    return len(nums)


Log in to reply
 

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