-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThreeSum.java
More file actions
27 lines (23 loc) · 789 Bytes
/
ThreeSum.java
File metadata and controls
27 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class ThreeSum {
public static void main(String[] args){
int[] nums = {-1,0,1,2,-1,-4};
List<List <Integer>> output = new LinkedList<>();
Arrays.sort(nums);
System.out.println(Arrays.toString(nums));
/* for(int i = 0; i < nums.length; i++){
for(int j = 0; j < nums.length; j++){
for(int k = 0; k < nums.length; k++){
if(i == j || i == k || j == k){
continue;
}
if(nums[i] + nums[j] + nums[k] == 0){
System.out.println(i + " " + j + " " + k);
}
}
}
} */
}
}