Stop Grinding LeetCode. There's a Better Way ðŸ§
We've all been there — opening LeetCode at midnight, doom-scrolling through problems, and convincing ourselves that solving 500 problems is the magic number for cracking FAANG interviews.
But here's the uncomfortable truth: most people who grind LeetCode are doing it wrong.
The Problem with Grinding
The typical approach looks like this:
- Pick a random problem
- Struggle for 30 minutes
- Look at the solution
- Feel bad about yourself
- Move to the next one
- Repeat
This is like trying to learn piano by randomly pressing keys. Sure, you're technically practicing, but you're not building any real skill.
The Better Way: Pattern Recognition
Instead of solving 500 random problems, focus on recognising 15-20 core patterns. Every LeetCode problem is a variation of a handful of fundamental techniques:
The Core Patterns
| Pattern | Example Problems | When to Use |
|---|---|---|
| Two Pointers | Container With Most Water, 3Sum | Sorted arrays, pair finding |
| Sliding Window | Longest Substring, Max Subarray | Contiguous subarray/substring |
| BFS/DFS | Number of Islands, Word Ladder | Graph/tree traversal |
| Dynamic Programming | Coin Change, LIS | Optimal substructure |
| Binary Search | Search in Rotated Array | Sorted data, decision problems |
| Backtracking | N-Queens, Permutations | Generate all combinations |
The Study Framework
For each pattern:
- Learn the template — understand the general structure
- Solve 3-5 easy problems to internalise it
- Solve 2-3 medium problems to build confidence
- Attempt 1 hard problem to test mastery
- Review after 3 days — spaced repetition
# Example: Sliding Window Template
def sliding_window(arr, k):
window_start = 0
result = 0
for window_end in range(len(arr)):
# Expand the window
# ... process arr[window_end]
# Shrink when window size > k
if window_end - window_start + 1 > k:
# ... remove arr[window_start]
window_start += 1
# Update result
result = max(result, current_calculation)
return result
Time Management
Here's a realistic schedule that works with a full-time job:
- Weekdays: 1 problem/day, 45 minutes max
- Weekends: 2-3 problems, focused on one pattern
- Sunday: Review week's problems without looking at solutions
In 8-10 weeks, you'll have covered all major patterns with ~60-80 well-understood problems.
The Secret Sauce: Explain Your Solutions
After solving a problem, explain your approach out loud as if you're in an interview. This does two things:
- Exposes gaps in your understanding
- Builds communication skills that interviewers actually evaluate
"The person who can solve a medium problem and explain it clearly will beat the person who can solve a hard problem but can't explain it."
Conclusion
Stop counting problems. Start counting patterns. Quality over quantity will always win in the long run.
Your move: Pick one pattern from the table above and commit to mastering it this week. That's it. Just one.
What patterns have worked for you? I'd love to hear your approach — reach out on Twitter.