package leetcode;

/**
 * https://leetcode.com/problems/x-of-a-kind-in-a-deck-of-cards/
 */
public class Problem914 {
    public boolean hasGroupsSizeX(int[] deck) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem914 prob = new Problem914();
        System.out.println(prob.hasGroupsSizeX(new int[]{1, 2, 3, 4, 4, 3, 2, 1})); // true
        System.out.println(prob.hasGroupsSizeX(new int[]{1, 1, 1, 2, 2, 2, 3, 3})); // false
        System.out.println(prob.hasGroupsSizeX(new int[]{1})); // false
        System.out.println(prob.hasGroupsSizeX(new int[]{1, 1})); // true
        System.out.println(prob.hasGroupsSizeX(new int[]{1, 1, 2, 2, 2, 2})); // true
        System.out.println(prob.hasGroupsSizeX(new int[]{1, 1, 1, 2, 2, 2})); // true
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 /**%0A * h
@@ -220,35 +220,529 @@
     
-// TODO%0A        return fals
+Map%3CInteger, Integer%3E map = new HashMap%3C%3E();%0A        for (int val : deck) %7B%0A            int count = map.getOrDefault(val, 0) + 1;%0A            map.put(val, count);%0A        %7D%0A        int min = Integer.MAX_VALUE;%0A        for (int count : map.values()) %7B%0A            min = Math.min(min, count);%0A            if (min %3C 2) %7B%0A                return false;%0A            %7D%0A        %7D%0A        for (int count : map.values()) %7B%0A            if (count %25 min != 0) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return tru
 e;%0A 
@@ -832,24 +832,26 @@
 oblem914();%0A
+//
         Syst
@@ -922,32 +922,34 @@
 , 1%7D)); // true%0A
+//
         System.o
@@ -1017,32 +1017,34 @@
  3%7D)); // false%0A
+//
         System.o
@@ -1099,16 +1099,18 @@
 / false%0A
+//
         
@@ -1167,32 +1167,34 @@
 , 1%7D)); // true%0A
+//
         System.o
@@ -1267,92 +1267,497 @@
 rue%0A
-        System.out.println(prob.hasGroupsSizeX(new int%5B%5D%7B1, 1, 1, 2, 2, 2%7D)); // tru
+//        System.out.println(prob.hasGroupsSizeX(new int%5B%5D%7B1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3%7D)); // true%0A//        System.out.println(prob.hasGroupsSizeX(new int%5B%5D%7B1, 1, 1, 2, 2, 2%7D)); // true%0A//        System.out.println(prob.hasGroupsSizeX(new int%5B%5D%7B1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3%7D)); // false%0A        System.out.println(prob.hasGroupsSizeX(new int%5B%5D%7B1, 1, 1, 1, 2, 2, 2, 2, 2, 2%7D)); // true%0A//        System.out.println(prob.hasGroupsSizeX(new int%5B%5D%7B1, 1, 1, 2, 2, 2, 2, 2%7D)); // fals
 e%0A  

Update problem 914