Your question is Array Triplets Sum to Zero. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The Divisions maintenance group needs to detect combinations of three maintenance adjustment values that cancel out to zero. 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 positions in nums. Do not return duplicate triplets, even when nums contains repeated values. Sort each triplet in nondecreasing order, and return the collection of triplets in lexicographic order. The input list may be modified.
def three_sum(nums):