feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent b434eb3a49
commit a7d29b7cce
203 changed files with 4526 additions and 0 deletions

View File

@@ -9,6 +9,30 @@ categories:
patterns:
- backtracking
function_signature: "def combination_sum3(k: int, n: int) -> list[list[int]]:"
test_cases:
visible:
- input: { k: 3, n: 7 }
expected: [[1, 2, 4]]
- input: { k: 3, n: 9 }
expected: [[1, 2, 6], [1, 3, 5], [2, 3, 4]]
- input: { k: 4, n: 1 }
expected: []
hidden:
- input: { k: 2, n: 3 }
expected: [[1, 2]]
- input: { k: 2, n: 17 }
expected: [[8, 9]]
- input: { k: 2, n: 18 }
expected: []
- input: { k: 9, n: 45 }
expected: [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
- input: { k: 3, n: 15 }
expected: [[1, 5, 9], [1, 6, 8], [2, 4, 9], [2, 5, 8], [2, 6, 7], [3, 4, 8], [3, 5, 7], [4, 5, 6]]
- input: { k: 5, n: 15 }
expected: [[1, 2, 3, 4, 5]]
description: |
Find all valid combinations of `k` numbers that sum up to `n` such that the following conditions are true: