feat(content): more test cases

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

View File

@@ -9,6 +9,24 @@ categories:
patterns:
- backtracking
function_signature: "def combination_sum(candidates: list[int], target: int) -> list[list[int]]:"
test_cases:
visible:
- input: { candidates: [2, 3, 6, 7], target: 7 }
expected: [[2, 2, 3], [7]]
- input: { candidates: [2, 3, 5], target: 8 }
expected: [[2, 2, 2, 2], [2, 3, 3], [3, 5]]
- input: { candidates: [2], target: 1 }
expected: []
hidden:
- input: { candidates: [1], target: 1 }
expected: [[1]]
- input: { candidates: [1], target: 2 }
expected: [[1, 1]]
- input: { candidates: [2, 3, 5], target: 5 }
expected: [[2, 3], [5]]
description: |
Given an array of **distinct** integers `candidates` and a target integer `target`, return *a list of all **unique combinations** of* `candidates` *where the chosen numbers sum to* `target`. You may return the combinations in **any order**.