哈希表
class Solution(object):
def containsDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
hash_map = {}
for num in nums:
if not hash_map.has_key(num):
hash_map[num] = 1
else:
hash_map[num] = hash_map[num] + 1
if hash_map[num] == 2:
return True
return False