Combination sum II
Problem Given candidate numbers (which may contain duplicates) and a target, return all unique combinations summing to the target; each candidate may be used at most once.
Input / Output
- Input: int array
candidates, inttarget. - Output: a list of unique combinations that sum to
target.
Constraints
- Up to 100 candidates, target <= 30 (classic bounds).
- The output must contain no duplicate combinations.
- Each candidate may be used at most once within a combination.
Example
- candidates = [10,1,2,7,6,1,5], target = 8 → [[1,1,6],[1,2,5],[1,7],[2,6]].
asked …