3sum
Difficulty: Medium
Source: LeetCode
Description
You are given an integer array nums, and the goal is to return all unique triplets [nums[i], nums[j], nums[k] such that each index is distinct and the sum of the three numbers is zero.
The answer must not include duplicate triplets, even if the same values appear multiple times in the array.
Please see full description in this link
Example
Example 1:
Input: nums = [-1, 0, 1, 2, -1, -4]
One valid output: [[-1, -1, 2], [-1, 0, 1]] (order of triplets or numbers within a triplet does not matter).
Code
# To be solved