39 combination sum
1.List<List<Integer>> res= new ArrayList<>();
2. dfs
if(target==0) res.add(new ArrayList<Integer>(subset); return;
if(target>0) return ;
for (int i=index;i< candidates.length;i++){
subset.add(candidates[i]);
dfs( candidates, targets-candidates[i], i , res, subset);
subset.remove(subset.size()-1);
浙公网安备 33010602011771号