Back to problems

Find Unique Zero-Sum Triplets

Algorithm · Microsoft · Medium

3Sum Medium · Array, Two Pointers, Sorting · Microsoft · Hint Write a function that receives an integer array nums and returns a list containing every unique triples of numbers from the array that sum to exactly zero. A valid triple must use three distinct indices in the array. The same value may appear in multiple triples as long as it comes from different positions. Duplicate triples – sets of the same three numbers regardless of order – must be listed only once. Inside…

Checking your access…