3Sum
Try to solve the 3Sum problem.
We'll cover the following
Statement
Given an integer array nums
, find and return all unique triplets [nums[i], nums[j], nums[k]]
, where the indexes satisfy i
j
, i
k
, and j
k
, and the sum of the elements nums[i] + nums[j] + nums[k] == 0
.
Constraints:
nums.length
nums[i]
Examples
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy