@@ -0,0 +1,1066 @@
+package leetcode.combination_sum_iii;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Solution %7B%0A    %0A    public void dfs(int curN, int rest, int depth, int k, List%3CInteger%3E cur, List%3CList%3CInteger%3E%3E ret)%7B%0A        if(depth == k && rest == 0)%7B%0A            ret.add(new ArrayList%3CInteger%3E(cur));%0A        %7Delse%7B%0A            for(int i = curN + 1; i %3C= 9; i++)%7B%0A                if(rest - i %3E= 0)%7B%0A                    cur.add(i);%0A                    dfs(i, rest - i, depth + 1, k, cur, ret);%0A                    cur.remove(depth);%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A    %0A    public List%3CList%3CInteger%3E%3E combinationSum3(int k, int n) %7B%0A        List%3CList%3CInteger%3E%3E ret = new ArrayList%3CList%3CInteger%3E%3E();%0A        dfs(0, n, 0, k, new ArrayList%3CInteger%3E(), ret);%0A        return ret;%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A        for(List%3CInteger%3E ans : new Solution().combinationSum3(3, 9))%7B%0A            for(int x : ans)%7B%0A                System.err.print(x + %22 %22);%0A            %7D%0A            System.err.println(%22%22);%0A        %7D%0A    %7D%0A%7D%0A

Add java solution for 216. Combination Sum III