Subsets & Combinations - Combination Sum II (No Reuse, Duplicates)
The following Python code attempts to solve Combination Sum II but sometimes returns duplicate combinations. Identify the bug:
```python
def combinationSum2(candidates, target):
candidates.sort()
res = []
def backtrack(start, path, target):
if target == 0:
res.append(path[:])
return
for i in range(start, len(candidates)):
if i > start and candidates[i] == candidates[i-1]:
continue
if candidates[i] > target:
break
backtrack(i+1, path + [candidates[i]], target - candidates[i])
backtrack(0, [], target)
return res
```
What is the cause of duplicates in the output?
