Python solution not working.

  • 0

    I have the code working in Local. but i get the following error

    Line 41: TypeError: range() integer end argument expected, got list.

    class Solution(object):
    def removeDuplicates(self, nums):
        :type nums: List[int]
        :rtype: int
        isSecond = False
        ele = -1
        arr = nums
        itemsTobeRemoved = []
        for i in arr:
            if ele != i:
                isSecond = False
                ele = i
            elif not isSecond:
                isSecond = True
        for item in itemsTobeRemoved:
        return arr

    Please suggest where i am doing it wrong. Thanks in advance.

  • 0

    The solution works perfectly in Ideone too.

  • 0

    You should return the length of the new array, not the new array itself

Log in to reply

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