217. 存在重复元素
1 class Solution 2 { 3 public: 4 bool containsDuplicate(vector<int>& nums) 5 { 6 unordered_map<int,int> hash; 7 for(auto a : nums) 8 { 9 if(++ hash[a] == 2) return true; 10 } 11 return false; 12 } 13 };
Mamba never out
1 class Solution 2 { 3 public: 4 bool containsDuplicate(vector<int>& nums) 5 { 6 unordered_map<int,int> hash; 7 for(auto a : nums) 8 { 9 if(++ hash[a] == 2) return true; 10 } 11 return false; 12 } 13 };