To use LeetCode effectively, you have to find and practice model problems. A good model problem is one that you haven’t solved too many times, is the right difficulty for your level, and focuses on a core concept rather than extraneous details.
Once you find a problem that meets these criteria, you can learn a lot by repeatedly solving it using a spaced repetition process. But even a great problem doesn’t stay useful forever. It eventually becomes so easy that you get nothing out of solving it again. Or after a few repetitions, you might find that it still doesn’t make sense to you because it requires a concept that you haven’t yet learned. In either case, you need a list of problems that you can draw from when you need a new one to practice.
You don’t have to look far to find a problem list. Since the goal is to master a set of concepts, it’s fine just to use the LeetCode problem page, where each problem is tagged with a concept. But with new problems being added every week, the number of problems in the official LeetCode list can seem overwhelming. The solution: use a problem list where someone has filtered the full LeetCode list down to a manageable size. Two examples are Tech Interview Handbook, the source of the well-known Blind 75 list, and NeetCode, which includes Blind 75 and other lists.
Even if you use a curated list, it’s still good to filter it according to your own unique criteria. Unless you have an expert tutor choosing a problem specifically for you, a list can only give you problems that are good for the average LeetCode user. A problem may still not meet your needs at a specific time on your practice journey. So, as you’re making your way through a list of problems, don’t worry about skipping a problem if it isn’t what you need.
Problem lists have different options for which problems to solve and in what order. But one option most of them provide is topic-wise practice. If you have a flexible schedule, this tried-and-true approach works best, along with spaced repetition. It’s the most straightforward way to learn each concept.
To use topic-wise practice, first decide on a concept to practice — for example, binary search. Then pick a problem list and find the recommended set of problems for that concept. Look through the list and find a problem to start with. You can skip problems if you already have experience with the concept, but when in doubt, start with the first problem. To practice it, use spaced repetition intervals: Start by practicing it every day, then every 2 days, 4 days, and so on. You can skip interval lengths if the problem is too easy. Once you get past the 1 day interval, you’ll need something else to practice. So pick the next problem on the list.
As you build out a spaced repetition schedule, you’ll generate a set of problems that cover a single concept and are spread out in some spaced distribution, with easier problems using shorter intervals and harder problems using longer ones. Once you get to the Medium problems for a concept, you should have a good idea about the fundamentals of the concept, and you should be familiar with a few problems that cover the key insights for that concept.
As you get started on your second concept, you’ll adjust your spaced repetition plan. Rather than a set of problems covering one concept, you’ll mix in problems that cover different concepts. This is by design, since you want to continue repeating the original concept so you don’t forget it while you learn the new concept. Let’s say your second concept is hash tables. For some repetitions, you’ll solve problems from binary search, and for others you’ll use hash table problems. So you’ll be learning hash tables while keeping binary search fresh by periodically solving those problems. By continuing this process, you can make your way through the full list of concepts.
This year, I’m publishing a series of tips for effective LeetCode practice. To read the tips in order, start with A Project for 2023.