要求:rt
思路:哈希表
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_map<int,int> m;
for(int &num:nums){
if(m.count(num))return true;
m[num]=1;
}
return false;
}
};
标签:217,return,nums,重复,元素,int,num,false
来源: https://blog.csdn.net/cx_cs/article/details/122585965