# Leetcode 40 - Combination sum II

`Note:`

- This is a backtracking problem
- The key is to remove repetitive elements that have appeared on the
`same level`

- Check
`i > startIndex`

because the leftmost node on each level can have the same value as its parent. - For example
`[1, 1, 2]`

. To avoid`[1,2]`

appearing twice, we have to check if`candidates[i] == candidates[i-1]`

in the for loop.

- Check
- Rememebr to
`sort`

candidates first before iterating, so elements with same value will be neighbors.

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.

Each number in candidates may only be used once in the combination.

Note: The solution set must not contain duplicate combinations.

**Example**

1 | Input: candidates = [10,1,2,7,6,1,5], target = 8 |

1 | /** |