Skip to content

Commit ec1951d

Browse files
add doctest all_combinations.py
1 parent 9a3687c commit ec1951d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

backtracking/all_combinations.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@ def combination_lists(n: int, k: int) -> list[list[int]]:
1616
1717
>>> combination_lists(n=4, k=2)
1818
[[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
19-
>>> combination_lists(n=1, k=1)
20-
[[1]]
21-
>>> combination_lists(n=3, k=0)
22-
[]
23-
>>> combination_lists(n=3, k=4)
24-
[]
25-
>>> combination_lists(n=-1, k=2)
26-
[]
27-
>>> combination_lists(n=4, k=-1)
28-
[]
19+
>>> combination_lists(n=5, k=3)
20+
[[1, 2, 3], [1, 2, 4], [1, 2, 5],
21+
[1, 3, 4], [1, 3, 5], [1, 4, 5],
22+
[2, 3, 4], [2, 3, 5], [2, 4, 5],
23+
[3, 4, 5]]
2924
"""
3025
return [list(x) for x in combinations(range(1, n + 1), k)]
3126

0 commit comments

Comments
 (0)