```
bool containsDuplicate(vector<int>& nums) {
//O(n) space and time
unordered_map<int,int> table;
for(vector<int>::iterator it = nums.begin();it<nums.end();it++){
unordered_map<int,int>::iterator temp = table.find(*it);
if(temp!=table.end()){
temp->second += 1;
if(temp->second >=2){
return true;
}
}else{
table.insert({*it,1});
}
}
return false;
}
bool containsDuplicate(vector<int>& nums) {
//O(nlogn) space and time
int size = nums.size();
if(size>1){
sort(nums.begin(), nums.end());
for(int i=0; i<size; ++i)
if(nums[i] == nums[i+1] && i+1 != size)
return true;
}
return false;
}
```

O(n) solution gave 52 ms but O(nlogn) 40 ms