Sum of Three Values
Try to solve the 3Sum problem.
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]