leetcode40. 组合总和 II

leetcode40. 组合总和 II_第1张图片
组合总和 II
class Solution:
    def combinationSum2(self, candidates, target):
        """
        :type candidates: List[int]
        :type target: int
        :rtype: List[List[int]]
        """
        res = []
        def dfs(remain,index,comb):
            if remain==0 and comb not in res:  #difference
                res.append(comb)
                return
            for i in range(index,len(candidates)):
                if remain

你可能感兴趣的:(leetcode40. 组合总和 II)