要求: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;
}
};