Premium

3Sum (find unique triplets that sum to zero)

By FrontendAtlas Editorial · Updated Jan 31, 2026

Challenge summary

Find every unique triplet whose values total zero while preventing duplicate result combinations.

What you'll practice

  • Sort a working copy without mutating the input array.
  • Use two-pointer movement to reduce unnecessary comparisons.
  • Skip duplicate values while returning each triplet in stable order.

What Premium unlocks

Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.

Free related practice

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.