C++ 2 lines Solution ^_^


  • 0
    W
        class Solution {
        public:
            bool containsDuplicate(vector<int>& nums) {
                sort(nums.begin(), nums.end());
                return unique(nums.begin(), nums.end()) != nums.end();
            }
        };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.