Patterns
AH · Pattern 00
Arrays & Hashing
Use hash maps and hash sets to trade space for time. Convert O(n²) lookups into O(n) by storing values you have seen. The foundation of almost every interview.
- Time
- O(n)
- Space
- O(n)
Spot it when
- "Two Sum" style: find pairs/groups with a property
- Detect duplicates or count frequencies
- Group items by a computed key (anagrams, frequency)
- "Find the element missing / extra" in O(n) time
Problems
Easy to hard · 0/10 solved