3Sum

Given an integer array nums, return every distinct triplet [nums[i], nums[j], nums[k]] such that i, j, and k are different and the three values add up to 0.

The output should not contain duplicate triplets, even if the input contains repeated numbers.

Examples
Input: [-18,-1,16,-8,9,-15,2,19,-192]
Output: [[-18,-1,19],[-18,2,16],[-15,-1,16],[-8,-1,9]]
Hints
Related Problems

3Sum

Given an integer array `nums`, return every distinct triplet `[nums[i], nums[j], nums[k]]` such that `i`, `j`, and `k` are different and the three values add up to `0`.