LeetCode217存在重复元素
未经博主同意,禁止瞎JB转载。
https://leetcode-cn.com/problems/contains-duplicate/description/
我的解法:
字典
class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ ret = {} for i in nums: if i in ret: return True else: ret[i] = 1 return False