feat(content): more test cases
This commit is contained in:
@@ -9,6 +9,28 @@ categories:
|
||||
patterns:
|
||||
- backtracking
|
||||
|
||||
function_signature: "def combination_sum2(candidates: list[int], target: int) -> list[list[int]]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { candidates: [10, 1, 2, 7, 6, 1, 5], target: 8 }
|
||||
expected: [[1, 1, 6], [1, 2, 5], [1, 7], [2, 6]]
|
||||
- input: { candidates: [2, 5, 2, 1, 2], target: 5 }
|
||||
expected: [[1, 2, 2], [5]]
|
||||
hidden:
|
||||
- input: { candidates: [1], target: 1 }
|
||||
expected: [[1]]
|
||||
- input: { candidates: [1], target: 2 }
|
||||
expected: []
|
||||
- input: { candidates: [1, 1, 1, 1, 1], target: 3 }
|
||||
expected: [[1, 1, 1]]
|
||||
- input: { candidates: [3, 1, 3, 5, 1, 1], target: 8 }
|
||||
expected: [[1, 1, 1, 5], [1, 1, 3, 3], [3, 5]]
|
||||
- input: { candidates: [2, 3, 6, 7], target: 7 }
|
||||
expected: [[7]]
|
||||
- input: { candidates: [4, 4, 2, 1, 4, 2, 2, 1, 3], target: 6 }
|
||||
expected: [[1, 1, 2, 2], [1, 1, 4], [1, 2, 3], [2, 2, 2], [2, 4]]
|
||||
|
||||
description: |
|
||||
Given a collection of candidate numbers (`candidates`) and a target number (`target`), find all unique combinations in `candidates` where the candidate numbers sum to `target`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user