其他分享
首页 > 其他分享> > 39 combination sum

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);

 

标签:subset,39,return,target,combination,res,sum,dfs,candidates
来源: https://www.cnblogs.com/LLflag1/p/16504268.html