I Solved 100+ LeetCode Problems — These Are the Patterns That Actually Matter
When I first started solving LeetCode problems, I made the same mistake many beginners make:
I tried to memorize solutions.
That approach worked for a few problems, but completely broke down once I encountered new variations.
After solving more than 100 problems, I realized that most interview questions are not testing specific solutions. They are testing whether you recognize the underlying pattern.
Instead of asking:
How do I solve this problem?
I started asking:
Which pattern is this problem testing?
That small shift changed everything.
1. Arrays & Hashing
Common problems:
- Two Sum
- Contains Duplicate
- Valid Anagram
- Group Anagrams
- Top K Frequent Elements
Core idea:
Use hash maps and hash sets to trade memory for speed.
Typical complexity target:
- Time: O(n)
- Space: O(n)
2. Two Pointers
Common problems:
- Valid Palindrome
- Two Sum II
- Container With Most Water
- 3Sum
Core idea:
Move two indices through a sorted structure or from opposite ends of a sequence.
Typical complexity target:
- Time: O(n)
- Space: O(1)
3. Sliding Window
Common problems:
- Best Time to Buy and Sell Stock
- Longest Substring Without Repeating Characters
- Minimum Window Substring
- Permutation in String
Core idea:
Expand and shrink a window while maintaining constraints.
Typical complexity target:
- Time: O(n)
4. Stack
Common problems:
- Valid Parentheses
- Min Stack
- Daily Temperatures
- Largest Rectangle in Histogram
Core idea:
Maintain information about previously seen elements.
Special pattern:
Monotonic Stack.
5. Binary Search
Common problems:
- Binary Search
- Search a 2D Matrix
- Search in Rotated Sorted Array
- Koko Eating Bananas
Core idea:
Search on answer space, not just on arrays.
This was one of the most important interview patterns for me.
6. Trees
Common problems:
- Maximum Depth of Binary Tree
- Same Tree
- Balanced Binary Tree
- Validate Binary Search Tree
Core idea:
Most tree questions become straightforward once you become comfortable with recursive DFS.
7. Heap / Priority Queue
Common problems:
- Kth Largest Element in an Array
- Last Stone Weight
- K Closest Points to Origin
- Find Median from Data Stream
Core idea:
Efficiently maintain the smallest or largest elements.
8. Backtracking
Common problems:
- Subsets
- Permutations
- Combination Sum
- N-Queens
Core idea:
Build a decision tree and explore all possibilities.
9. Graphs
Common problems:
- Number of Islands
- Clone Graph
- Course Schedule
- Word Ladder
Core idea:
Most graph problems reduce to DFS, BFS, or Topological Sort.
10. Dynamic Programming
Common problems:
- Climbing Stairs
- House Robber
- Coin Change
- Longest Increasing Subsequence
Core idea:
Store solutions to smaller subproblems and reuse them.
Final Thoughts
The biggest improvement in my interview preparation came from organizing problems by pattern rather than by difficulty.
Once you recognize the pattern, the implementation becomes much easier.
If you're currently learning LeetCode, focus less on memorizing solutions and more on identifying the recurring techniques behind them.
What pattern took you the longest to understand?
I recently organized detailed notes, explanations, and visual walkthroughs for these patterns on my personal site:
I'm continuously adding new problems and explanations as I work through them.
Top comments (0)