4Sum
Medium
Arrays
Array
Two Pointers
Sorting
Find all unique quadruplets that sum to target. Each on a line.
Constraints
1 ≤ nums.length ≤ 200
Examples
Example 1:
Input: 1 0 -1 0 -2 2
0
Output: -2 -1 1 2
-2 0 0 2
-1 0 0 1
Example 2:
Input: 2 2 2 2 2
8
Output: 2 2 2 2
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console