查找表_leetcode217


# 解题思路:字典存储计数状态 20190302 找工作期间

class Solution(object):
def containsDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""

record = {}

for i in range(len(nums)):
record[nums[i]]=record.get(nums[i],0)+1
if record[nums[i]] >= 2:
return True


return False
posted @ 2019-03-17 14:36  AceKo  阅读(92)  评论(0)    收藏  举报