Medium · Backtracking
Combination Sum II
Given an array candidates of positive integers (values may repeat) and a positive integer target, return every distinct combination of candidates that sums to target, using each array element at most once and listing each combination once, in any order.
Examples
Example 1
cand=[10,1,2,7,6,1,5], t=8Output: 4 combos
Example 2
cand=[2,5,2,1,2], t=5Output: 2 combos
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.