@@ -0,0 +1,600 @@
+package hashtable;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A/**%0A * Created by Yue on 2017/10/27.%0A * 575. Distribute Candies%0A */%0Apublic class DistributeCandies %7B%0A    public static int distributeCandies(int%5B%5D candies) %7B%0A        Set%3CInteger%3E set = new HashSet%3C%3E();%0A        for (int c : candies)%0A            set.add(c);%0A        return set.size() %3C= candies.length / 2 ? set.size() : candies.length / 2;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        int%5B%5D candies = new int%5B%5D %7B1, 2, 3, 4, 5, 6, 7, 5, 3, 4, 2, 6, 10%7D;%0A        System.out.println(distributeCandies(candies));%0A    %7D%0A%7D%0A

add leetcode no.575