items. For a report they need to be laid out as a table with rows rows and cols columns.
Fill the table row by row: the first cols numbers of the tape make the first row, the next cols make the second, and so on. The order of the numbers stays the same.
The table must be completely filled and use every number. If that is impossible (there are more or fewer numbers than rows · cols), return an empty list.items=[4, 8, 15, 16, 23, 42], rows=3, cols=2 → [[4, 8], [15, 16], [23, 42]]
Six numbers exactly fill 3 rows of 2: [4, 8], [15, 16], [23, 42].
items=[7, 7, 3], rows=1, cols=3 → [[7, 7, 3]]
A single row of three takes the whole list.
items=[1, 2, 3, 4, 5], rows=2, cols=2 → []
A 2 × 2 grid holds 4 numbers but there are 5, so it cannot be done and the answer is empty.
items=[4, 8, 15, 16, 23, 42], rows=3, cols=2
[[4, 8], [15, 16], [23, 42]]
Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.