feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent e28da5def2
commit 0f264ef603
94 changed files with 1840 additions and 0 deletions

View File

@@ -9,6 +9,22 @@ categories:
patterns:
- backtracking
function_signature: "def combine(n: int, k: int) -> list[list[int]]:"
test_cases:
visible:
- input: { n: 4, k: 2 }
expected: [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
- input: { n: 1, k: 1 }
expected: [[1]]
hidden:
- input: { n: 5, k: 3 }
expected: [[1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 3, 4], [1, 3, 5], [1, 4, 5], [2, 3, 4], [2, 3, 5], [2, 4, 5], [3, 4, 5]]
- input: { n: 3, k: 1 }
expected: [[1], [2], [3]]
- input: { n: 2, k: 2 }
expected: [[1, 2]]
description: |
Given two integers `n` and `k`, return *all possible combinations of* `k` *numbers chosen from the range* `[1, n]`.