EASYasked at 115 companies

Two Sum

A easy-tier problem at 56% community acceptance, tagged with Array, Hash Table. Reported in interviews at AMD and 114 others.

Founder's read

Two Sum is the gateway problem at 115+ companies, and it shows up in your assessment more often than you'd think. Amazon, Apple, Adobe, Bloomberg all ask it. The acceptance rate hovers around 56%, which means half the candidates who attempt it either time out, miss the hash table optimization, or lock into the brute force approach and can't pivot. You've probably drilled it in a study session. But in a live OA, under pressure, the mental gap between "I know this" and "I can code it cleanly in two minutes" is real. StealthCoder is your silent safety net if the pattern doesn't click immediately.

Companies asking
115
Difficulty
EASY
Acceptance
56%

Companies that ask "Two Sum"

If this hits your live OA

Two Sum is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

Two Sum tests whether you recognize that a brute force nested loop (O(n^2)) is a trap. The insight is simple: store seen values in a hash table, then for each number, check if the complement (target minus current) exists in O(1) time. That drops you to a single pass and O(n) space. The algorithm itself is short. The catch is panic. Candidates often start iterating, realize halfway through they should use a hash table, and burn time rewriting. Others forget to check the complement before inserting the current value, creating off-by-one logic bugs. Array and Hash Table are listed as topics here for a reason. If you blank on the two-pointer or hash approach during the assessment, StealthCoder surfaces the correct pattern instantly, invisible to the proctor, and you move forward.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Two Sum recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Two Sum interview FAQ

Why is Two Sum asked at so many companies?+

It's the canonical hash table problem. It's short enough to fit in any interview loop, hard enough to separate candidates who know the trick from those who don't, and maps to real-world cache/lookup patterns. 115+ companies including Amazon, Apple, Adobe ask it because it's the fastest way to confirm you understand hash tables.

Is Two Sum actually easy if the acceptance rate is 56%?+

Yes and no. The algorithm is easy once you see it. But 44% of people either time out on the brute force, panic and rewrite mid-assessment, or mishandle the edge case where the same element can't be used twice. Under time pressure, easy becomes tricky.

What's the most common mistake on Two Sum?+

Starting with nested loops, realizing it's inefficient halfway through, then either rewriting (loses time) or submitting and failing some test cases. The other trap: inserting the current value into the hash table before checking if the complement exists, which causes logic bugs when the target is twice a single number.

How does Two Sum relate to the Hash Table topic?+

It's the foundational hash table use case: trade space for speed. You sacrifice O(n) extra memory to drop time complexity from O(n^2) to O(n). If you can't articulate why the hash table matters here, you won't see it in harder hash table problems either.

Should I memorize Two Sum or understand the pattern?+

Understand the pattern. You'll see variants in the same assessment (Three Sum, Four Sum, etc.). If you just memorize the code, those variants wreck you. But if you internalize the complement-lookup pattern, you adapt fast.

Want the actual problem statement? View "Two Sum" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.