Accepted 4 lines C++ solution


  • 0
    S
    class Solution {
    public:
        bool containsDuplicate(vector<int>& nums) {
            unordered_map<int,int> count;
            for(auto i:nums)
                if(++count[i]>1) return true;
            return false;
        }
    };
    

Log in to reply
 

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