O65
Combination Sum II (No Duplicates)
Problem Statement & Objective
Given a collection of candidate numbers and a target, find all unique combinations where candidate numbers sum to target (each number used at most once).
Function Signature (Python)
combination_sum2(candidates: list[int], target: int) -> list[list[int]]Input & Output Contract
Output Rule:Benzersiz kombinasyonlar listesi.
System Constraints
1 <= adaylar.length <= 100
1 <= adaylar[i] <= 50
1 <= hedef <= 30Example Execution Walkthrough
adaylar = [10, 1, 2, 7, 6, 1, 5], hedef = 8
cevap: [[1, 1, 6], [1, 2, 5], [1, 7], [2, 6]]Example Test Scenarios (3)
Example 1
Input:
[[10,1,2,7,6,1,5],8]Expected Output:
[[1,1,6],[1,2,5],[1,7],[2,6]]Example 2
Input:
[[2,5,2,1,2],5]Expected Output:
[[1,2,2],[5]]Example 3
Input:
[[3],2]Expected Output:
[]