@@ -0,0 +1,1535 @@
+// Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.%0A%0A// The same repeated number may be chosen from C unlimited number of times.%0A%0A// Note:%0A// All numbers (including target) will be positive integers.%0A// Elements in a combination (a1, a2, %E2%80%A6 , ak) must be in non-descending order. (ie, a1 %E2%89%A4 a2 %E2%89%A4 %E2%80%A6 %E2%89%A4 ak).%0A// The solution set must not contain duplicate combinations.%0A// For example, given candidate set 2,3,6,7 and target 7, %0A// A solution set is: %0A// %5B7%5D %0A// %5B2, 2, 3%5D %0A%0Apublic class Solution %7B%0A    public List%3CList%3CInteger%3E%3E combinationSum(int%5B%5D candidates, int target) %7B%0A%09%09List%3CList%3CInteger%3E%3E result = new ArrayList%3CList%3CInteger%3E%3E();%0A%09%09int len = candidates.length;%0A%09%09List%3CInteger%3E tempList = new ArrayList%3CInteger%3E();%0A%0A%09%09if(len == 0) return%09 result;%0A%0A%09%09Arrays.sort(candidates);%0A%0A%09%09dfs(result, tempList, candidates, target, 0, 0, len);%0A%0A%09%09return result;%0A    %7D%0A%0A    public void dfs(List%3CList%3CInteger%3E%3E result, List%3CInteger%3E tempList, int%5B%5D candidates, int target, int currentSum, int index, int len)%7B%0A    %09if(currentSum == target)%7B%0A    %09%09result.add(new ArrayList%3CInteger%3E(tempList));%0A    %09%09return;%0A    %09%7Delse if(index == len)%7B%0A    %09%09return;%0A    %09%7D%0A%0A    %09for(int i = index; i %3C candidates.length; i++)%7B%0A    %09%09if(currentSum + candidates%5Bi%5D %3C= target)%7B%0A    %09%09%09tempList.add(candidates%5Bi%5D);%0A%09    %09%09dfs(result, tempList, candidates, target, currentSum + candidates%5Bi%5D, i, len);%0A%09    %09%09tempList.remove(tempList.size() -1);%0A    %09%09%7D%0A    %09%7D%0A    %7D%0A%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A

add combination sum solution