What's wrong with my one-line code?


  • 0
    9

    What's wrong with my one-line code?

    class Solution(object):
    def removeDuplicates(self, nums):
    """
    :type nums: List[int]
    :rtype: int
    """
    return len(list(set(nums)))
    

    why you get [1,2] when input is [1,1,2]?????


Log in to reply
 

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