Back to problems

Return Unique Three-Sum Value Triples

Algorithm · Google · Hard

Given an integer array nums and an integer target, examine every selection of three pairwise-different positions of nums. For each selection, order the three values it holds so they are non-decreasing, $$a \le b \le c$$, and keep the selection only when $$a + b + c = \text{target}$$. A triple is identified by the values it contains and their multiplicities, not by the positions that produced it. So when several position selections yield the same three values, that value…

Checking your access…