problem statement
problem faced-It did not pass all the test cases,please help.
//my code in java is below
public class Solution {
public List<List> threeSum(int[] nums) {
ArrayList<List> result = new ArrayList<>();
for (int i = 0; i < nums.length; i++) {
for (int j = i + 1; j < nums.length; j++) {
for (int k = j + 1; k < nums.length; k++) {
if (nums[i] + nums[j] + nums[k] == 0) {
List list = Arrays.asList(nums[i], nums[j], nums[k]);
Collections.sort(list);
result.add(list);
}
}
}
}
return result;
}
}