TL;DR (Frontend Version)
- Most frontend DSA = arrays + strings + hashing
- Kill nested loops with:
- HashMap
- Two Pointers
- Sliding Window
- If sorted → think two pointers
- If “longest/shortest subarray/substring” → sliding window
- If “seen before?” → hash set/map
1️⃣ Core Patterns You Actually Need
🟢 1. Hashing (MOST IMPORTANT)
Frontend interviews LOVE this.
Use when:
- Need O(1) lookup
- Counting frequency
- Detect duplicates
- Complements (Two Sum)
Common cues:
- “seen before”
- “first unique”
- “frequency”
- “anagram”