Reported October 2025
AT&Ttwo pointers

3Sum

Reported by candidates from AT&T's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live AT&T OA. Under 2s to a working solution.
Founder's read

AT&T reported this 3Sum variant in October 2025, and the whole thing hinges on one move: sort the array first. Once it's sorted, a two-pointer sweep does the heavy lifting and duplicates become easy to skip. You need unique triplets summing to 0, each sorted, returned in lexicographic order. That's a classic you've probably seen, but the dedupe logic is where people lose the points. If you blank on it during the live OA, StealthCoder is the invisible safety net running on your desktop. Know the shape of the solution before you sit down.

The problem

Given an integer array nums, return every unique triplet [a, b, c] whose values sum to 0.
Each returned triplet must be sorted in ascending order. Return the complete list of triplets in lexicographic order, without duplicates.

Function
threeSum(nums: int[]) → int[][]

Examples
Example 1
nums = [-1,0,1,2,-1,-4]
return = [[-1,-1,2],[-1,0,1]]
The two unique value triplets that sum to 0 are [-1,-1,2] and [-1,0,1].
Example 2
nums = [0,0,0,0]
return = [[0,0,0]]
All valid index choices produce the same value triplet, so [0,0,0] appears only once.

Constraints
3 <= nums.length <= 3000.
-100000 <= nums[i] <= 100000.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Sort nums. Loop i from 0 to n-3. Skip i if nums[i] equals nums[i-1]. Set left = i+1 and right = n-1. If the sum is below 0, move left up. If it's above 0, move right down. On a hit, record the triplet, then advance left and right past any repeated values. That's O(n^2) time, fine for n up to 3000. The common pitfall is dedupe. Don't use a hash set of triplets as your main idea, it's slower and messier. Another trap is skipping duplicates before recording the first hit, which kills cases like [-1,-1,2]. Because the array is sorted and you iterate in order, output comes out lexicographic for free. Also add an early break when nums[i] > 0. If your pointer logic goes sideways mid-assessment, StealthCoder can hand you the clean version while you keep typing.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill 3Sum cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as 3sum. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass AT&T's OA.

AT&T reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

3Sum FAQ

What's the trick to AT&T's 3Sum problem?+

Sort first, then fix one number and run two pointers on the rest. Sorting lets you skip duplicates by comparing neighbors and gives you lexicographic output without extra work. It brings the cost down from O(n^3) brute force to O(n^2).

How do I avoid duplicate triplets?+

Skip the outer index if it matches the previous value. After a hit, move left and right forward and backward while they equal their last values. Record the triplet before skipping, otherwise you'll miss cases like [-1,-1,2] where repeats are valid.

Will O(n^2) pass with 3000 elements?+

Yes. With nums.length up to 3000, n squared is about 9 million operations, which is comfortable. Brute force at O(n^3) would be around 27 billion and fail. Sorting costs O(n log n), which is negligible next to the main loop.

Do I need to sort the output separately?+

No. If the input is sorted and you iterate i ascending with left ascending, triplets are found in lexicographic order. Each triplet is also internally ascending since nums[i] <= nums[left] <= nums[right]. Just append results as you find them.

How do I prep for this in 48 hours?+

Write the sorted two-pointer solution from scratch three times. Then test [0,0,0,0], [-1,0,1,2,-1,-4], all positives, and all negatives. Focus on the duplicate-skip lines, since that's where bugs live. Skip fancy variants, this one is a well-known pattern.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with AT&T.

OA at AT&T?
Invisible during screen share
Get it