You're given an integer array. Find all unique triplets [nums[i], nums[j], nums[k]] such that nums[i] + nums[j] + nums[k] = 0.
With nums = [-1, 0, 1, 2, -1, -4], the answer is [[-1, -1, 2], [-1, 0, 1]]. Both triplets sum to zero. Notice that duplicate triplets like [-1, 0, 1] appearing twice are not allowed.
This builds on Two Sum. If you fix one number, can you use two pointers to find pairs that sum to its negative?
Constraints: , values from to .