【leetcode❤python】217. Contains Duplicate
#-*- coding: UTF-8 -*-
class Solution(object):
def containsDuplicate(self, nums):
numsdic={}
for num in nums:
numsdic[num]=numsdic[num]+1 if num in numsdic else 1
if numsdic[num]>=2:
return True
return False
sol=Solution()
print sol.containsDuplicate(nums=[1,2,3,4,4])