Problem
Given a list of integers nums, return every unique triplet [a, b, c] of values taken from three different positions where a + b + c == 0. Two triplets with the same values count as the same triplet, so do not repeat them. The order of the triplets, and of the values inside each one, does not matter.
Example 1
- Input
- nums = [-1, 0, 1, 2, -1, -4]
- Output
- [[-1, -1, 2], [-1, 0, 1]]
Example 2
- Input
- nums = [0, 1, 1]
- Output
- []
Example 3
- Input
- nums = [0, 0, 0, 0]
- Output
- [[0, 0, 0]]
Constraints
3 <= nums.length <= 3000-10^5 <= nums[i] <= 10^5