A daily practice habit can help you improve, but not every daily practice routine works equally well. If done incorrectly, it can become more of a chore to check off your to-do list than a useful learning tool. As we have seen so far this year, the LeetCode practice process relies on choosing model problems, writing model solutions, and practicing them using a spaced repetition process. Here are two more key ideas to ensure that your daily practice routine works smoothly.
First, problem selection. As you are learning the set of fundamental LeetCode concepts, the best approach for problem selection is what competitive programmers call topic-wise practice. Using this approach, you don’t worry about how to find the correct approach for an unknown problem. Instead, you pick problems where you know which algorithm or technique to use, and focus on learning how to implement it. To ensure that you get a well-rounded understanding, choose problems that use the algorithm or technique in different ways. To find relevant problems, use LeetCode tags or curated lists like the ones on Tech Interview Handbook.
Finding topic-wise problems is also a good way to take advantage of the daily challenge. As you’re working on the daily challenge, look for problems that use a familiar topic in a new way. When you find a problem like this, add it to your topic-wise list. By collecting a few problems for each topic, you can learn it more thoroughly than you would just by practicing one problem on a topic and moving on.
The second key idea: Keep a practice journal for each model problem. When you repeat a problem, record the date and your observations about that repetition. If you had trouble solving the problem (even if you eventually solved it) isolate the part of the problem that gave you trouble and make a note of it. As you record your daily progress, also review your model solution. If you can update the solution to make the challenging part of the problem clearer, this is the time to improve the code, the description, or both. If you check your notes for the previous repetition and find that you got stuck on the same part, that’s a sign that your model solution is still missing something. After multiple repetitions of this process, your understanding of the problem and your model solution should converge until you have mastered the problem and there’s nothing more to add to your solution.
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.