Get the number of distinct candies by Set. If the number of rest candies is smaller that half, than, need to give bro some distinct candies

```
public class Solution {
public int distributeCandies(int[] candies) {
HashSet<Integer> set = new HashSet<Integer>();
for (int i = 0; i < candies.length; i++) {
set.add(candies[i]);
}
return Math.min(set.size(), (candies.length / 2 + candies.length % 2));
}
}
```