DSA Interview Preparation: The 12 Patterns That Cover Most Coding Problems (Blind 75 and NeetCode 150)
By Preeti Verma
Most people prepare for coding interviews by solving problems at random and hoping the real question looks familiar. It rarely works, and it is exhausting. A better approach is to learn the patterns behind the problems. A few dozen patterns explain a huge share of what is asked, and once you recognise the pattern, the solution has a shape you already know.
This guide gives you 12 patterns, how to spot each one from the problem statement, and a sensible way to use the popular Blind 75 and NeetCode 150 lists.
Why patterns beat random practice
When you solve a problem you have never seen, the hard part is not writing code. It is deciding what kind of problem it is. If you have practised patterns, you ask yourself a few questions ("Is this a sorted array? Is it asking for a subarray? Does it involve choices at each step?") and the right tool comes to mind.
The 12 patterns
1. Two pointers
Spot it when: the input is sorted (or can be), and you are looking for a pair, or you need to compare from both ends. Idea: keep one pointer at each end (or both at the start) and move them based on a condition, giving O(n) instead of O(n squared). Practise: Two Sum II (sorted), 3Sum, Container With Most Water, Valid Palindrome.
2. Sliding window
Spot it when: you need the best subarray or substring that satisfies a condition, often with words like "longest", "shortest" or "at most k". Idea: maintain a window with two indexes, expand the right side, and shrink the left when the condition breaks. Practise: Longest Substring Without Repeating Characters, Minimum Window Substring, Maximum Average Subarray.
3. Fast and slow pointers
Spot it when: a linked list or sequence might have a cycle, or you need the middle. Idea: one pointer moves one step, the other two. If they meet, there is a cycle. Practise: Linked List Cycle, Middle of the Linked List, Happy Number.
4. Binary search (including "search on the answer")
Spot it when: the data is sorted, or the answer lies in a range and you can test whether a candidate answer works. Idea: halve the search space each step. For "minimum speed so that you finish in time" problems, binary search the answer itself and check feasibility. Practise: Binary Search, Search in Rotated Sorted Array, Koko Eating Bananas.
5. Hash map for lookups and counting
Spot it when: you need to find something fast, count occurrences, or check "have I seen this before?". Idea: trade memory for speed. Store what you have seen so each check is O(1). Practise: Two Sum, Group Anagrams, Top K Frequent Elements, Subarray Sum Equals K (with prefix sums).
6. Prefix sums
Spot it when: you repeatedly need the sum of a range, or the count of subarrays with a certain sum. Idea: precompute running totals so any range sum is one subtraction. Practise: Range Sum Query, Subarray Sum Equals K, Product of Array Except Self.
7. Stack and monotonic stack
Spot it when: you deal with matching brackets, nested structure, or "next greater element". Idea: use a stack to remember unresolved items. A monotonic stack keeps its items in sorted order so you can answer "next bigger or smaller" in O(n). Practise: Valid Parentheses, Daily Temperatures, Largest Rectangle in Histogram.
8. Intervals
Spot it when: the input is a list of ranges (meetings, bookings). Idea: sort by start time, then sweep and merge or compare with the previous interval. Practise: Merge Intervals, Insert Interval, Meeting Rooms II.
9. Tree traversal (DFS and BFS)
Spot it when: the input is a tree. Depth-first (recursion) fits "paths", "depth" and "validate" problems. Breadth-first (a queue) fits "level by level". Practise: Maximum Depth of Binary Tree, Level Order Traversal, Validate BST, Lowest Common Ancestor.
10. Graphs: BFS, DFS and topological sort
Spot it when: you have a grid, connections, or dependencies. Idea: treat cells or items as nodes. BFS finds shortest paths in unweighted graphs. DFS explores and marks visited. Topological sort orders tasks with prerequisites. Practise: Number of Islands, Clone Graph, Course Schedule, Word Ladder.
11. Backtracking
Spot it when: you must generate all combinations, subsets, permutations or arrangements, with choices at each step. Idea: choose, explore, undo. Prune branches that cannot work. Practise: Subsets, Permutations, Combination Sum, N-Queens, Word Search.
12. Dynamic programming
Spot it when: you can break the problem into overlapping smaller problems and want a count, a minimum or a maximum. Idea: define the state in plain words, write the recurrence, then memoise or build a table. Start with 1D problems before 2D. Practise: Climbing Stairs, House Robber, Coin Change, Longest Increasing Subsequence, Longest Common Subsequence.
A few more worth knowing after these: heaps for "top K" problems, union-find for connected components, and tries for prefix searches.
How to use Blind 75 and NeetCode 150
Both are curated problem lists, not magic. Use them like this:
- Blind 75 is the shorter list. If you have a few weeks, finish it. It covers the core patterns above.
- NeetCode 150 adds more problems and groups them by topic, which suits learning one pattern at a time. Choose it if you have a couple of months.
- Go by pattern, not by number. Do the two pointers problems together, then sliding window, and so on.
- Revisit. A problem you solved once and never saw again will not stay with you. Repeat the ones you struggled with after a week.
GenQuest's Resources section lists both Blind 75 and NeetCode 150 with LeetCode links and tracks your progress.
A routine that works
For each problem:
- Read and restate it in your own words. Ask about edge cases.
- Name the pattern or say which two you are choosing between.
- Give the brute force first and its complexity. Then improve it.
- Code it cleanly, and test with a small example and an edge case.
- State time and space complexity without being asked.
If you are stuck for 20 to 25 minutes, read the hint or solution, then close it and code it from memory the next day. Reading solutions is fine. Not re-solving them is the mistake.
Practising the talking part
Coding interviews are also speaking interviews. You need to explain your thinking while you code, which is a separate skill. Practise thinking aloud on easy problems, then try a mock interview with coding practice so someone responds to your approach. If you are building a full schedule, our 30-day interview preparation plan shows where DSA fits alongside Java and system design.
FAQ
How many problems do I need to solve? There is no magic number. Understanding 80 to 100 problems by pattern usually beats rushing through 300.
Should I memorise solutions? No. Memorise patterns and the reasoning, not code.
What language should I use? The one you are most fluent in. For Java developers that is usually Java, but Python is also accepted at many companies.
The takeaway
Learn the 12 patterns, practise them in groups, repeat the hard ones, and talk through your reasoning. Ten solid pattern-based weeks will serve you better than months of random problems.