@@ -0,0 +1,735 @@
+import java.util.HashSet;%0Aimport java.util.Set;%0A%0Apublic class LeetCode0575 %7B%0A    public int distributeCandies(int%5B%5D candies)%0A    %7B%0A        if (candies == null %7C%7C candies.length == 0) %7B%0A            return 0;%0A        %7D%0A        int total = candies.length / 2;%0A        Set%3CInteger%3E set = new HashSet%3C%3E();%0A        for (int i = 0; i %3C candies.length; i++) %7B%0A            set.add(candies%5Bi%5D);%0A            if (set.size() == total) %7B%0A                return total;%0A            %7D%0A        %7D%0A        return set.size();%0A    %7D%0A%0A    public static void main(String%5B%5D args)%0A    %7B%0A        LeetCode0575 leetcode = new LeetCode0575();%0A        int%5B%5D candies = new int%5B%5D %7B 1, 1, 2, 3 %7D;%0A        System.out.println(leetcode.distributeCandies(candies));%0A    %7D%0A%7D

Add LeetCode0575.java