public static <T> List<List<List<T>>> group(List<T> list, List<Integer> gss) {
        if (gss.isEmpty()) {
            List<List<List<T>>> lists = new ArrayList<>();
            lists.add(new ArrayList<>());
            return lists;
        }
        int n = gss.get(0);
        List<Integer> ns = gss.subList(1, gss.size());
        List<List<List<T>>> result = new ArrayList<>();
        for (List<T> c : combinations(list, n)) {
            List<T> remaining = remaining(list, c);
            for (List<List<T>> cg : group(remaining, ns)) {
                List<List<T>> sg = new ArrayList<>();
                sg.add(c);
                sg.addAll(cg);
                result.add(sg);
            }
        }
        return result;
    }
In how many ways can a group of 9 people work in 3 disjoint subgroups of 2, 3 and 4 persons?
Write a predicate that generates all the possibilities via backtracking
java8/src/main/java/com/shekhargulati/ninetynine_problems/_01_lists/P27.java