0. 题目
1. 回溯
找出 无重复元素 的整数数组,组成target的所有可能。可以按 任意顺序 返回这些组合。
注意:
res.append(tmp[:]) #这里不能append动态变化的tmp!!!
class Solution(object):
def combinationSum(self, candidates, target):
candidates.sort()
res = []
# DFS [2,3,6,7] 7
def backtrack(t,tmp,idx):
if idx==len(candidates): #防止死循环