mycode  76.39%

class Solution(object):
    def containsDuplicate(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        if len(nums) == 0 or len(nums) == 1:
            return False
        return not (len(set(nums)) == len(nums))

 

参考  

最快:

class Solution(object):
    def containsDuplicate(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        hasht = {}
        for num in nums:
            if num not in hasht:
                hasht[num] = True
            else:
                return True
        return False