Generates all possible combinations of k numbers out of 1 ... n using itertools. >>> combination_lists(n=4, k=2) [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
(n: int, k: int)
| 11 | |
| 12 | |
| 13 | def combination_lists(n: int, k: int) -> list[list[int]]: |
| 14 | """ |
| 15 | Generates all possible combinations of k numbers out of 1 ... n using itertools. |
| 16 | |
| 17 | >>> combination_lists(n=4, k=2) |
| 18 | [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]] |
| 19 | """ |
| 20 | return [list(x) for x in combinations(range(1, n + 1), k)] |
| 21 | |
| 22 | |
| 23 | def generate_all_combinations(n: int, k: int) -> list[list[int]]: |
no test coverage detected