C++ 1-liner


  • 1
    V
    int distributeCandies(vector<int>& c) {
        return min(unordered_set<int>(begin(c), end(c)).size(), c.size() / 2);
    }
    

Log in to reply
 

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