题目解题思路代码 题目类型:Array 解题思路贪心算法 代码class Solution { public int distributeCandies(int[] candyType) { Set<Integer> set = new HashSet<Integer>(); for (int candy : candyType) { set.add(candy); } return Math.min(set.size(), candyType.length / 2); }}