LeetCode Patterns
Introduction
"Grinding LeetCode" by randomly solving hundreds of questions is the least efficient way to prepare for technical interviews.
There are currently over 3,000 questions on LeetCode. You cannot memorize all of them. Fortunately, you don't have to. Almost every single question is a variation of a few core patterns.
If you understand the underlying pattern, you can solve 50 questions that you have never seen before.
What is a Pattern?
A pattern is a combination of a Data Structure and an Algorithm tailored to solve a specific class of constraints.
For example, the Sliding Window pattern is a combination of Two Pointers moving across an Array/String in \(O(N)\) time, used specifically for "contiguous subarray" problems.
Once you recognize the keywords in a prompt, you simply apply the template for that pattern.
The Big 3 Lists
The software engineering community has curated several famous lists of questions that perfectly encapsulate these patterns. You should focus your practice entirely on these lists rather than random questions:
- Blind 75: The original curated list. The absolute minimum you must know.
- NeetCode 150: An expansion of the Blind 75, categorized perfectly by pattern. This is the gold standard for modern interview prep.
- Grind 75: A dynamic list created by the author of the Blind 75, which adjusts based on how many weeks you have to prepare.
Key Takeaways
- Stop solving random LeetCode questions.
- Focus entirely on learning the patterns.
- Stick to curated lists like the NeetCode 150.