Combination Sum

This is a problem in leetcode. To solve this problem, I decide to use recursion on it: class Solution { public List<List<Integer>> combinationSum(int[] candidates, int target) { List<List<Integer>> res = new ArrayList<List<Integer>>(); List<Integer> rec = new ArrayList<Integer>(); search( candidates, target, res, rec, 0); return res; } private void search(int[] arr, int tar, List<List<Integer>>res, List<Integer>rec, int …