classSolution:defcombinationSum2(self,candidates: List[int],target:int) -> List[List[int]]: n =len(candidates) results = [] candidates.sort()defdfs(path,t,start):if t <0:returnif t ==0: results.append(path[:]) seen =set()for i inrange(start, n):if candidates[i]in seen:continue seen.add(candidates[i]) path.append(candidates[i])dfs(path, t - candidates[i], i +1) path.pop()dfs([], target, 0)return results