2 Lines of solution


  • 0
    X
        int distributeCandies(vector<int>& candies) 
        {
            unordered_set<int> table(candies.begin(),candies.end());
            return min(table.size(),candies.size()/2);
        }
    

Log in to reply
 

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