```
Input: [8,7,4,3], 11
Output: [[4,4,3],[7,4],[8,3]]
Expected: [[3,4,4],[3,8],[4,7]]
```

My code:

```
public ArrayList<ArrayList<Integer>> combinationSum(int[] candidates, int target) {
return sum(candidates,target,new ArrayList<Integer>(),0);
}
public ArrayList<ArrayList<Integer>> sum(int[] test,int target,ArrayList<Integer> list,int index){
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if( target ==0){
result.add(list);
return result;
}
if(target < 0||index == test.length){
return result;
}
//No taking current node
result.addAll(sum(test,target,new ArrayList<Integer>(list),index+1));
//take current node
list.add(test[index]);
result.addAll(sum(test,target-test[index],list,index));
return result;
}
```