关键:会用Set
class Solution {
public:
int distributeCandies(vector<int>& candyType) {
int k1=candyType.size();
set<int> se;
for (auto candy:candyType)
se.insert(candy);
int k2=se.size();
if (k1/2<=k2)
return k1/2;
else
return k2;
}
};