4Sum
Try to solve the 4Sum problem.
We'll cover the following
Statement
Given an array nums
of integers, return an array of all the unique quadruplets, [nums[a]
, nums[b]
, nums[c]
, nums[d]
] such that:
-
a
,b
,c
,d
-
a
,b
,c
, andd
are distinct. -
nums[a]
+nums[b]
+nums[c]
+nums[d]
target
You may return the answer in any order.
Constraints:
-
nums.length
-
nums[i]
-
target
Examples
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.