3Sum

Medium · Arrays & Strings · about 25 minutes

Asked at Meta, Amazon, Microsoft, Apple, Palo Alto Networks, Zscaler.

Given an integer array nums, return every unique triplet [a, b, c] of values taken from three different positions such that a + b + c == 0. The answer must not contain duplicate triplets; triplets and the values inside them may be in any order.

Related guides