Home ›
Quick-Fire 50 — Interview Cheatsheet
Quick-Fire 50 — Interview Cheatsheet
The 50 problems that show up most in FAANG + Indian tech interviews (Amazon, Google, Meta, PhonePe, Flipkart, Uber). Bookmark this page and review before every interview.
💡 How to use: Scan the “Approach” column. If you can’t explain it in 10 seconds, that’s the one to practice.
Arrays & Hashing
Two Pointers
| # |
Problem |
Approach |
Time |
Space |
| 9 |
Valid Palindrome |
Left/right pointers, skip non-alphanumeric, compare |
O(n) |
O(1) |
| 10 |
3Sum |
Sort + fix one, two-pointer on rest. Skip duplicates. |
O(n²) |
O(1) |
| 11 |
Container With Most Water |
Left/right, move the shorter side inward |
O(n) |
O(1) |
| 12 |
Trapping Rain Water |
Two pointers with leftMax/rightMax tracking |
O(n) |
O(1) |
Sliding Window
Stack
Binary Search
Linked List
Trees
Graphs
| # |
Problem |
Approach |
Time |
Space |
| 35 |
Number of Islands |
BFS/DFS from each ‘1’, mark visited |
O(m×n) |
O(m×n) |
| 36 |
Clone Graph |
BFS/DFS + HashMap (old node → new node) |
O(V+E) |
O(V) |
| 37 |
Course Schedule |
Topological sort (BFS Kahn’s or DFS cycle detection) |
O(V+E) |
O(V+E) |
| 38 |
Word Ladder |
BFS level-by-level, change one char at a time |
O(n·26·L) |
O(n·L) |
| 39 |
Dijkstra’s Shortest Path |
Min-heap + relaxation |
O((V+E) log V) |
O(V) |
Dynamic Programming
| # |
Problem |
Approach |
Time |
Space |
| 40 |
Climbing Stairs |
dp[i] = dp[i-1] + dp[i-2] (Fibonacci) |
O(n) |
O(1) |
| 41 |
Coin Change |
dp[i] = min(dp[i-coin]+1) for each coin |
O(amount×coins) |
O(amount) |
| 42 |
Longest Increasing Subsequence |
DP: O(n²) or patience sort with binary search: O(n log n) |
O(n log n) |
O(n) |
| 43 |
Word Break |
dp[i] = any dp[j] && s[j:i] in dict |
O(n²·L) |
O(n) |
| 44 |
House Robber |
dp[i] = max(dp[i-1], dp[i-2] + nums[i]) |
O(n) |
O(1) |
| 45 |
Edit Distance |
2D DP: insert/delete/replace at each (i,j) |
O(m×n) |
O(m×n) |
Greedy / Intervals
| # |
Problem |
Approach |
Time |
Space |
| 46 |
Merge Intervals |
Sort by start, extend end if overlapping |
O(n log n) |
O(n) |
| 47 |
Meeting Rooms II |
Sort starts + ends separately, sweep with counter |
O(n log n) |
O(n) |
| 48 |
Jump Game |
Track farthest reachable index |
O(n) |
O(1) |
| 49 |
Non-Overlapping Intervals |
Sort by end, greedily keep earliest-ending |
O(n log n) |
O(1) |
| 50 |
Task Scheduler |
Count max-freq task, compute idle slots |
O(n) |
O(26) |
Pattern Recognition Cheatsheet
| If you see… |
Try this pattern |
| “Sorted array + find pair/target” |
Two Pointers |
| “Contiguous subarray/substring with constraint” |
Sliding Window |
| “Find minimum/maximum that satisfies condition” |
Binary Search on Answer |
| “Shortest path in unweighted graph” |
BFS |
| “All combinations/permutations” |
Backtracking (DFS) |
| “Overlapping subproblems + optimal substructure” |
Dynamic Programming |
| “Next greater/smaller element” |
Monotonic Stack |
| “Connected components / merge groups” |
Union-Find |
| “Task dependencies / ordering” |
Topological Sort |
| “Prefix matching / dictionary” |
Trie |
| “Intervals overlap/merge” |
Sort by start + sweep |
| “Top K / Kth largest” |
Heap (Priority Queue) |
Complexity Quick Reference
| Structure |
Access |
Search |
Insert |
Delete |
| Array |
O(1) |
O(n) |
O(n) |
O(n) |
| HashMap |
— |
O(1) avg |
O(1) avg |
O(1) avg |
| BST (balanced) |
— |
O(log n) |
O(log n) |
O(log n) |
| Heap |
O(1) peek |
O(n) |
O(log n) |
O(log n) |
| Stack/Queue |
O(1) top |
O(n) |
O(1) |
O(1) |
| Sort |
Best |
Average |
Worst |
Stable? |
| Merge Sort |
O(n log n) |
O(n log n) |
O(n log n) |
Yes |
| Quick Sort |
O(n log n) |
O(n log n) |
O(n²) |
No |
| Heap Sort |
O(n log n) |
O(n log n) |
O(n log n) |
No |
| Tim Sort (Java/Python default) |
O(n) |
O(n log n) |
O(n log n) |
Yes |
The 10 “Must-Solve-First” Problems
If you only have 3 days, solve these — they cover the most patterns with the least problems:
- Two Sum (HashMap)
- Best Time to Buy/Sell Stock (Greedy/Kadane)
- Longest Substring Without Repeating (Sliding Window)
- 3Sum (Two Pointers + Sort)
- Merge Intervals (Sort + Sweep)
- Number of Islands (BFS/DFS)
- Coin Change (DP)
- LRU Cache (HashMap + DLL)
- Course Schedule (Topological Sort)
- Valid Parentheses (Stack)
Bookmark this page. Review it 30 minutes before every coding interview.
Want detailed solutions? Check the DSA problems section.
💬 Comments