why my solution does not work?

  • 0

    my solution is not that clean and elegant, but it's functional in my own python 2.7 and python 3.6 environment, Could any guys give me a hint?

    class Solution(object):
        def removeDuplicates(self, nums):
            :type nums: List[int]
            :rtype: int
            existed = list()
            d = dict()
            for i in nums:
                if i in d.keys():
                    d[i]+= 1
                if d[i] <= 2:
            return len(existed)

Log in to reply

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