Distribute Candies LeetCode solution in Java

1
class Solution {
2
public int distributeCandies(int[] candyType) {
3
Set<Integer> set = new HashSet<>();
4
for (int type : candyType) set.add(type);
5
return Math.min(set.size(), candyType.length / 2);
6
}
7
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0