哈希表
217. 存在重复元素
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_set<int> Hash;
for(auto i : nums){
if(Hash.count(i)) return true;
else Hash.insert(i);
}
return false;
}
};1. 两数之和
350. 两个数组的交集 II
387. 字符串中的第一个唯一字符
383. 赎金信
242. 有效的字母异位词
141. 环形链表
349. 两个数组的交集
454. 四数相加 II
169. 多数元素
128. 最长连续序列
560. 和为 K 的子数组
718. 最长重复子数组
最后更新于