Two solutions: 1) use sort and unique (40ms)
sort(nums.begin(),nums.end());
return unique(nums.begin(), nums.end()) != nums.end();

use set (48ms)
set<int> s(nums.begin(), nums.end());
return s.size() != nums.size();
My question is why "sort" solution is faster than "set" solution????? In my mind, "set" solution is O(n), while "sort" solution is at least O(nlogn).