python solution is not working


  • 0
    M

    Why my code is not working

        def removeDuplicates(self, nums):
      
            if not (len(nums)):
                return 0
            i=0
            j=1
            new_len=0
            for i in  range(len(nums) -1 ):
                if nums[i] != nums[j] :
                    new_len = new_len + 1
                nums[j] = nums[i]
            
            
            return new_len
            
    

Log in to reply
 

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