public class Solution {

public List<List<Integer>> threeSum(int[] num) {

Arrays.sort(num);

List<List<Integer>> result = new ArrayList<List<Integer>>();

helper(num, 0, new ArrayList<Integer>(), result, 0);

return result;

}

```
private void helper(int [] num, int start, List<Integer> current, List<List<Integer>> result, int left) {
if(current.size() == 3) {
if(left == 0) {
result.add(new ArrayList<Integer>(current));
}
return;
}
for(int i = start; i < num.length; i++) {
if(i > start && num[i] == num[i - 1]) {
continue;
}
current.add(num[i]);
helper(num, i + 1, current, result, left - num[i]);
current.remove(current.size() - 1);
}
}
```

}