Prompt: Given a list of integers, nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

Note: a + b + c = 0
-(a + b) = c
a is positive
b is negative
c is whatever

Example:

Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
Input: nums = []
Output: []
Input: nums = [0]
Output: []

Solution: Let’s refer back to the notes. First, we have to separate all positive and negative integers in nums. In order to find all the triplets that satisfy all the conditions, we can search through all possible combinations of [a,b] from the sets of positive and negative integers. Then, we can check if -(a+b) is in nums. If it is in nums, then it is possible that [a,b,-(a+b)] is one of the answers.

One last condition that we need to check is that a,b, and c are not the same integer in the same position in nums. Since we are not including the exact position of the integers in the solution we only need to find if there are the same integers in nums. An appropriate solution for this is a Counter dictionary. We just need to confirm that a != b, a != c, and a != b if the count of a,b, or c is 1.