clean python code


  • 0
    Y
    class Solution:
        def removeDuplicates(self, nums):
            if not nums:
                return 0
            i=0
            val=nums[i]
            while i<=len(nums):
                if nums[i]==val:
                    nums.pop(i)
                else:
                    val=nums[i]
                    i+=1
            return len(nums)
    

Log in to reply
 

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