wuyijia

导航

哈希表基础题217. 存在重复元素、389. 找不同、496. 下一个更大元素 I

217. 存在重复元素 1 class Solution: 2 def containsDuplicate(self, nums: List[int]) -> bool: 3 #方法1:set去重,直接比较去重之后数组长度 4 if len(set(nums)) != len(nums): 5 re

posted on 2023-08-28 13:22  小吴要努力  阅读(3)  评论(0编辑  收藏  举报