The 20 Most Asked Coding Interview Problems of All Time

- Two Sum is the most reported interview problem in history and filters engineers who know when to reach for a hash map, not just that one exists
- Maximum Subarray: initialize Kadane's to
nums[0], not 0, or the answer breaks on all-negative arrays - Merge Intervals has a silent bug: the merged end must be
max(last.end, current.end), notcurrent.end - Minimum Window Substring requires a counter of characters at their required frequency to keep the validity check O(1) rather than O(k)
- These 20 problems span 12 distinct patterns; knowing why each approach works beats memorizing it
Spoiler: Two Sum is still number one. It was number one in 2019. It will be number one in 2029. Engineers walk out of Google, Meta, and Amazon loops every week and post exactly what they were asked, and when you cross-reference enough of those reports, the list is basically the same twenty problems, year after year, company after company.
This is not because interviewers are lazy. It is because these problems are genuinely good at separating candidates who understand a technique from candidates who have seen the answer. There is a difference, and interviewers can tell.
What Earned a Spot Here
Each problem passes two tests: it appears repeatedly across multiple companies over multiple years, and it teaches a generalizable pattern rather than a single trick. The ranking draws from LeetCode company tag frequency data, aggregated candidate reports on Blind and Teamblind, and the curated sets from the Blind 75 and the Tech Interview Handbook. Trick problems and clever-but-rare outliers are excluded.
The 20 Most Asked Coding Interview Problems, Ranked
1. Two Sum (LC 1), The One You've Seen a Thousand Times
Pattern: Hash map, complement lookup.
The O(n²) brute force takes thirty seconds to write and tells the interviewer nothing useful. The O(n) solution requires seeing that "does my complement exist?" is a hash map query. This problem filters engineers who know hash maps exist from engineers who know when to reach for them. It is the most reported interview problem in history, used as a warm-up screen at Amazon, Google, Microsoft, and Meta across all levels.
Candidates who have ground LeetCode for three months still fumble this under pressure because they memorized the solution without internalizing the pattern. The complement lookup is the lesson. Everything else is noise.
2. Valid Parentheses (LC 20)
Pattern: Stack, matching pairs.
Every character either pushes an opener or demands a pop. The stack top is always the most recently unclosed bracket, the only one that can legally match the current closer. If you reach for a counter variable here, you have missed why the stack is necessary. A counter gets the balanced case right. It fails on ]()[ because it cannot tell you what kind of thing you're missing.
Interviewers use this to check whether your stack intuition is real or just pattern-matched.
3. Maximum Subarray (LC 53)
Pattern: Kadane's algorithm, 1D DP.
The best subarray ending at index i either extends the best subarray ending at i-1 or starts fresh. current = max(nums[i], current + nums[i]). Initialize current to nums[0], not 0, or the answer is wrong for all-negative arrays. Kadane derived this in under a minute at a 1984 CMU seminar. Most interview candidates take considerably longer.
It has appeared in interviews ever since that seminar. Forty-plus years and counting.
4. Group Anagrams (LC 49)
Pattern: Hash map, key normalization.
Anagrams share a sorted form and a 26-bucket character frequency fingerprint. Both work as hash keys. The frequency tuple is O(k) instead of O(k log k) per string, which matters when strings are long. Every grouping problem where equivalent items share some canonical form follows this same shape, which is why it keeps showing up.
5. Product of Array Except Self (LC 238)
Pattern: Prefix products left-to-right, suffix products right-to-left.
The brute force uses division. The interviewer bans division in the follow-up. (They always ban division.) The solution is two passes: fill the output array with prefix products going left, then multiply in suffix products coming right. Internalize this and Trapping Rain Water, Sum of Subarray Minimums, and several others become immediate.
6. Longest Substring Without Repeating Characters (LC 3)
Pattern: Sliding window, expand right, shrink left on duplicate.
The window tracks whether the incoming character is already inside. If it is, advance the left pointer past the previous occurrence. The only pointer that retreats is the left pointer, and it only retreats until the duplicate is gone. Everything in the sliding window pattern builds on this expand-shrink mechanic. The full breakdown is in the sliding window algorithm guide.
7. Merge Intervals (LC 56)
Pattern: Sort by start time, greedy merge.
Sort by start. For each new interval, either merge with the last in the output or start a new one. The merged end is max(last.end, current.end), not current.end. Skip the max and contained intervals silently truncate the merged result. This bug is quiet. The output looks plausible, just wrong.
This template is the parent of at least five interval variants. The merge intervals pattern has the full breakdown.
8. Binary Tree Level Order Traversal (LC 102)
Pattern: BFS, queue length snapshot.
Before processing each level, snapshot len(queue). Process exactly that many nodes, then add their children. Without the snapshot, the queue grows mid-loop and there is no way to tell where one level ends and the next begins. This template reappears in right side view, zigzag traversal, and level averages. One pattern, many problems.
9. 3Sum (LC 15)
Pattern: Sort, two-pointer inward scan, duplicate skipping.
Fix one element. Run two pointers from both ends of the remaining array to find the complementary pair. After finding a valid triple, skip all duplicate values on both sides before continuing. Miss this and the output contains identical triples. Getting duplicate handling right, including when the fixed element itself repeats, is what the problem is actually testing.
The sorting step is free. The duplicate skipping is where people lose points.
10. Trapping Rain Water (LC 42)
Pattern: Prefix max array, suffix max array, single pass.
Water at bar i is min(maxLeft[i], maxRight[i]) - height[i]. Pre-compute both max arrays in two O(n) passes, then compute water in a third. The two-pointer variant eliminates the extra arrays: if maxLeft < maxRight, the left bar is the bottleneck regardless of what lies to the right, so process it. You do not need to know the exact right max. You just need to know it is at least rightMax, which is enough.
Google uses this problem specifically to find candidates who can optimize from O(n²) to O(n) time and then to O(1) extra space in the same interview. Two separate insights, one problem.
11. Number of Islands (LC 200)
Pattern: Grid BFS/DFS, connected components.
When you find an unvisited '1', increment the count and BFS outward to mark the entire island visited. The outer loop iterating over all cells is not optional. Islands can be disconnected. This catches a surprising number of candidates who assume a single BFS from one starting point will find everything.
Clone Graph, Surrounded Regions, and Pacific Atlantic Water Flow are all minor variations on this outer-loop-plus-BFS structure.
12. Course Schedule (LC 207)
Pattern: Topological sort, cycle detection.
Build a directed graph from prerequisites. Run Kahn's BFS. If the number of nodes processed does not equal n, a cycle exists and you cannot complete all courses. Recognizing when a dependency problem maps to a directed graph is the skill being tested. The BFS mechanics are not hard. The modeling is.
13. Coin Change (LC 322)
Pattern: 1D DP, bottom-up, unbounded knapsack.
dp[i] is the minimum coins to reach amount i. For each coin, update dp[i] = min(dp[i], dp[i - coin] + 1). Initialize dp to infinity except dp[0] = 0. Forward iteration allows reusing the same coin, which is what "unbounded knapsack" means. Iterate backward and you are solving 0/1 knapsack instead, silently.
The dynamic programming framework covers why this works from first principles.
14. Word Break (LC 139)
Pattern: 1D DP on a string.
dp[i] is whether s[:i] is segmentable. For each i, check all j < i where dp[j] is true and s[j:i] is in the word set. This is not a greedy problem. Neither the longest match nor the shortest match is always correct. Candidates who default to greedy here get burned by inputs designed specifically to break it.
Amazon and Meta use Word Break to watch whether candidates test their greedy instinct before committing.
15. Kth Largest Element in an Array (LC 215)
Pattern: Min-heap of size k.
Maintain a min-heap of the k largest elements seen. When the heap exceeds k elements, pop the minimum. After one pass, the heap's minimum is the kth largest element. The Quickselect variant gives O(n) average time and shows up as a follow-up when the interviewer wants to see if you know there is something faster.
This is the entry problem for the top-k pattern, which covers K Closest Points, Task Scheduler, and a dozen others.
16. LRU Cache (LC 146)
Pattern: HashMap + doubly linked list with sentinel nodes.
A hash map alone gives O(1) get but O(n) eviction. A doubly linked list with sentinel head and tail nodes gives O(1) move-to-front and O(1) removal. Together they give O(1) for both get and put. The sentinel nodes eliminate null checks on every pointer operation, which is the part that makes this implementable cleanly in a real interview without three pointer bugs.
The LRU cache implementation has the full sentinel node approach.
17. Find Median from Data Stream (LC 295)
Pattern: Two heaps, max-heap for lower half, min-heap for upper half.
After each insertion, rebalance so heap sizes differ by at most one. The median is the top of the larger heap, or the average of both tops if sizes are equal. This is the hardest problem on this list to implement cleanly under pressure. It tests whether you can maintain a continuous invariant across unbounded insertions without losing track of which heap is which and whether to rebalance before or after computing the median.
Getting the rebalance direction wrong gives you a number. Just not the right one.
18. Clone Graph (LC 133)
Pattern: BFS/DFS with a hash map for node identity.
The hash map is not optional. Without it you revisit nodes, create duplicates, and very likely loop forever on any cycle. Map each original node to its clone before recursing into neighbors. The mistake candidates make is cloning nodes eagerly without checking whether the clone already exists, then wondering why the graph has seventeen copies of node 2.
19. Word Search (LC 79)
Pattern: DFS + backtracking on a grid.
Mark the current cell visited before recursing, then unmark it when the call returns. Without the unmark step, the cell stays forbidden for every other path through the grid, not just the current one. Your search finds nothing because you marked the whole board visited on the first attempt.
Word Search II adds a trie for pruning. Microsoft, Amazon, and others use this to check whether candidates genuinely understand the undo step in backtracking.
20. Minimum Window Substring (LC 76)
Pattern: Sliding window with two frequency maps.
Expand the right pointer until the window contains all required characters. Shrink the left pointer while the window is still valid, recording the minimum length. Track how many distinct characters have hit their required frequency, not just whether all characters are present. That one counter makes the validity check O(1) instead of O(k). Solving this cleanly, without iterating over the frequency map every step, is a strong signal.
This is the capstone sliding window problem. If you can implement it without bugs, you understand the pattern.
What This List Is Actually Telling You
These 20 problems span roughly 12 distinct patterns. Solve each one until you can explain why the approach works, not just what the approach is. The gaps after this list are harder variants: complex 2D DP state spaces, advanced graph algorithms, bitmask DP. They all build on this foundation.
There is one thing this list cannot teach: performing under interview conditions. Thinking out loud while you code, handling hints without getting defensive, recovering from a bug without going silent for three minutes. Those skills require practice in a setting that mirrors the actual interview. If you want reps on exactly these problems with rubric-based feedback on communication and problem-solving, SpaceComplexity runs voice-based mock interviews against this problem set.
Further Reading
- LeetCode Top Interview Questions:official curated problem list
- Tech Interview Handbook: Best Practice Questions:frequency-ranked by Yangshun Tay, former Meta Staff Engineer
- Blind 75 Original Teamblind Post:the 2018 post that started the curated list movement
- NeetCode Blind 75 with Video Solutions:video explanations for each problem
- GeeksforGeeks Must-Do Interview Problems:company-specific breakdowns