When to use it
Reach for Two Sum when a hash map & set problem matches the cues in this lesson — especially after you’ve ruled out a brute-force nested scan.
Pattern
Two Sum is a reusable approach under Hash Map & Set. Once you recognize the shape of the input and the ask, this pattern gives you a standard plan instead of inventing a new algorithm from scratch.
Reach for Two Sum when a hash map & set problem matches the cues in this lesson — especially after you’ve ruled out a brute-force nested scan.
Reference implementation in C#, Python, Java, JavaScript, and C++.
Interviewers grade pattern recognition. Naming Two Sum early shows you can classify the problem inside Linear DS.
Drill Two Sum with Hash Map & Set problems — filter the bank and solve 2–3 Easy/Medium items while saying the invariant out loud.
Related Hash Map & Set problems — open any one and apply Two Sum.
Two Sum
Hash Map
Longest Substring Without Repeating Characters
Sliding Window
Integer to Roman
Greedy
Roman to Integer
Greedy
Letter Combinations of a Phone Number
Backtracking
Substring with Concatenation of All Words
Sliding Window
Valid Sudoku
Hash Table
Sudoku Solver
Backtracking
First Missing Positive
Array