Back
3Sum
Find all unique triplets in the array which gives the sum of zero.
Java
Description
Solution
My Code
3Sum
Find all unique triplets in the array which gives the sum of zero.
Example 1:
Input:
[-1,0,1,2,-1,-4]
Output:
[[-1,-1,2],[-1,0,1]]
Viz
Tests
Run
Input
Standard
Zeros
No Solution
Custom
[-1,0,1,2,-1,-4]
arr =
[-1,0,1,2,-1,-4]
Status
Start 3Sum
Current Sum (i+L+R)
?
Sorted Array
-1
0
0
1
1
2
2
3
-1
4
-4
5
Found Triplets (0)
No triplets found yet
Variables
No variables to display
Depth
Function Call
Stack empty
0/34
0.5x
1x
2x
4x