3Sum
Given an integer array nums, return all unique triplets [a, b, c] such that a + b + c === 0. No triplet may be duplicated in the result.
The standard approach: sort, then for each index fix one number and use two pointers on the rest to find pairs summing to its negation, skipping duplicates as you go.
threeSum([-1, 0, 1, 2, -1, -4]); // [[-1, -1, 2], [-1, 0, 1]]
threeSum([0, 1, 1]); // []The tests sort the result before comparing, so ordering of the triplets doesn't matter, but each triplet's own values are expected in ascending order (a natural consequence of sorting first).