Skip to content

Instantly share code, notes, and snippets.

@xzhang311
Created April 8, 2016 14:56
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_map<int, int> myMap;
for(int i=0; i<nums.size(); i++){
if(myMap[nums[i]]==1)
return true;
else
myMap[nums[i]]=1;
}
return false;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment