Spotify playlist analysis may need to identify three track scores whose combined adjustment is neutral. Given an integer array nums, return every unique triplet [a, b, c] such that a + b + c == 0.
Implement three_sum(nums). The input is a list of integers. Return a list of triplets, where each triplet contains values from three different array positions and is sorted in nondecreasing order. The result must not contain duplicate triplets, and the ordering of triplets may be arbitrary.
You may modify nums in place while solving the problem.
def three_sum(nums):