LeetCode 15 3Sum - Problem Statement

The problem

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: 3n30003 \le n \le 3000, values from 105-10^5 to 10510^5.