function threeSum(nums) {
  const ans = new Set();

  for (let i = 0; i < nums.length; i++) {
    for (let j = i + 1; j < nums.length; j++) {
      for (let k = j + 1; k < nums.length; k++) {
        if (nums[i] + nums[j] + nums[k] === 0) {
          ans.add(JSON.stringify([nums[i], nums[j], nums[k]].sort()));
        }
      }
    }
  }

  return Array.from(ans).map((s) => JSON.parse(s));
}
@param {number[]} nums
@return {number[][]}

@runtime O(n^3)