|
5 | 5 | importjava.util.List; |
6 | 6 | importjava.util.Map; |
7 | 7 |
|
8 | | -/** |
9 | | - * 1282. Group the People Given the Group Size They Belong To |
10 | | - * |
11 | | - * There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. |
12 | | - * Given the array groupSizes of length n telling the group size each person belongs to, return the groups there are and the people's IDs each group includes. |
13 | | - * You can return any solution in any order and the same applies for IDs. |
14 | | - * Also, it is guaranteed that there exists at least one solution. |
15 | | - * |
16 | | - * Example 1: |
17 | | - * Input: groupSizes = [3,3,3,3,3,1,3] |
18 | | - * Output: [[5],[0,1,2],[3,4,6]] |
19 | | - * Explanation: |
20 | | - * Other possible solutions are [[2,1,6],[5],[0,4,3]] and [[5],[0,6,2],[4,3,1]]. |
21 | | - * |
22 | | - * Example 2: |
23 | | - * Input: groupSizes = [2,1,3,3,3,2] |
24 | | - * Output: [[1],[0,5],[2,3,4]] |
25 | | - * |
26 | | - * Constraints: |
27 | | - * groupSizes.length == n |
28 | | - * 1 <= n <= 500 |
29 | | - * 1 <= groupSizes[i] <= n |
30 | | - * */ |
31 | 8 | publicclass_1282 { |
32 | 9 | publicstaticclassSolution1 { |
33 | 10 | publicList<List<Integer>>groupThePeople(int[]groupSizes) { |
|