Difficulty in solving a problem

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;
}
}

Hey @Somasree i am not sure about java, but you can mention the test case you are failing , i can help you with logic building , also share your code with ide.codingblocks.com so that i can share it with someone who knows java and can help you with this.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.