(
int[] candidates,
int target,
List<List<Integer>> ans,
List<Integer> ls,
int index
)
| 9 | } |
| 10 | |
| 11 | public void comb( |
| 12 | int[] candidates, |
| 13 | int target, |
| 14 | List<List<Integer>> ans, |
| 15 | List<Integer> ls, |
| 16 | int index |
| 17 | ) { |
| 18 | if (target == 0) { |
| 19 | ans.add(new ArrayList(ls)); |
| 20 | } else if (target < 0) return; else { |
| 21 | for (int i = index; i < candidates.length; i++) { |
| 22 | if (i > index && candidates[i] == candidates[i - 1]) continue; |
| 23 | ls.add(candidates[i]); |
| 24 | comb(candidates, target - candidates[i], ans, ls, i + 1); |
| 25 | ls.remove(ls.get(ls.size() - 1)); |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | } |
no test coverage detected