@@ -0,0 +1,1181 @@
+//%0A// Created by Joshua.cao, 2018/10/14%0A//%0A// https://leetcode.com/problems/combination-sum-iii/%0A//%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class CombinationSumThree %7B%0A  public List%3CList%3CInteger%3E%3E combinationSum3(int k, int n) %7B%0A    List%3CList%3CInteger%3E%3E resultList = new ArrayList%3C%3E();%0A    List%3CInteger%3E currentSet = new ArrayList%3C%3E();%0A    helper(resultList, currentSet, 0, k, n);%0A%0A    return resultList;%0A  %7D%0A%0A  public void helper(List%3CList%3CInteger%3E%3E resultList,%0A        List%3CInteger%3E currentSet, int start, int k, int remain) %7B%0A    if (remain == 0 && currentSet.size() == k) %7B%0A      resultList.add(new ArrayList%3C%3E(currentSet));%0A      return;%0A    %7D%0A    if (start %3E= 9) return;%0A%0A    for (int i = start; i %3C 9; i++) %7B%0A      if (i + 1 %3E remain) break;%0A      currentSet.add(i + 1);%0A      helper(resultList, currentSet, i + 1, k, remain - i - 1);%0A      currentSet.remove(new Integer(i + 1));%0A    %7D%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    CombinationSumThree obj = new CombinationSumThree();%0A    // System.out.println(obj.combinationSum3(3, 7));%0A    // System.out.println(obj.combinationSum3(3, 9));%0A    System.out.println(obj.combinationSum3(3, 15));%0A  %7D%0A%7D

216 combination sum three