What's wrong with my solution?(python)


  • 0
    D
     class Solution:
        # @param a list of integers
        # @return an integer
        def removeDuplicates(self, A):
            lst = []
            if not A:
                return 0
            for item in A:
                if item not in lst:
                    lst.append(item)
            return len(lst)

Log in to reply
 

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