LeetCode encourages you to develop a daily LeetCode habit. Every day, they identify one of their problems as the Daily LeetCoding Challenge problem. If you solve that problem, you extend your daily streak. If you don’t, your streak resets to zero. This gives you a reason to open the site every day and solve the daily problem.
But while it’s possible to learn something by following this daily habit, you won’t keep getting better forever. Eventually, a daily habit will only maintain your current skill level. To improve further, you need a different approach.
To learn more about the ideas in this tip, see Which Works Better: Habits or Projects? by Scott Young.*
Regular practice is necessary for improvement, but it isn’t sufficient. The path of least resistance in daily practice is to repeat skills that you already know. This type of practice isn’t useless. You’ll at least avoid losing those skills. But you won’t get any better.
To improve your skills rather than just maintaining them, you first have to find a strategic area to improve. Your practice journal should have some suggestions. Find a problem you have practiced before and check your most recent notes. Unless you have mastered the problem, your practice notes should identify a part of the problem that you had trouble with. If you work on something that you found difficult in your last repetition, then you have a chance of improving.
Improvement requires more effort and attention than just practicing every day. You have to analyze your performance and figure out what gave you trouble. And it isn’t always obvious what to work on. For example, let’s say you practice a problem that requires binary search and you correctly identify binary search as an appropriate algorithm, but you can’t figure out how to use binary search for this specific problem. You know how to implement binary search, so that’s not what you need to work on. You know enough about what a binary search problem looks like that you selected the right algorithm. But something about the application of binary search still eludes you. You have to figure out what that is, so you can learn and practice it. This analysis takes time, but it’s necessary.
Sometimes a daily habit can block improvement. If you implement an algorithm many times over many days and weeks, you’ll eventually stop thinking about the individual steps. It will be so easy that your fingers will just implement it on their own. This is useful for easier problems. It lets you finish those problems quickly. But harder problems may require you to modify the algorithm in subtle ways. Rather than thinking of the algorithm as a black box, you’ll have to take it apart and look at each step, the way you did when you were first learning it. You may have to unlearn habits if they are preventing you from understanding the algorithm well enough to apply it to hard problems.
If you’re practicing LeetCode regularly, take some time once in a while to ask yourself if you’re improving, or just practicing.
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.