C++ 32ms solution


  • 0
    Y
    bool containsDuplicate(vector<int>& nums) 
        {
            unordered_map <int,int> um;
            int count=0;
            for(auto a:nums)
            {
                um[a]=0;
                count++;
                if(count>um.size())
                    return true;
            }
            return false;
        }
    

Log in to reply
 

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