When starting with competitive programming, we start off by really getting motivated about studying different algorithms, solving problems and participating in contests but gradually lose motivation with time and stop practicing. If this has happened to you, you are not alone. This has happened with every one of us, and the same happened to me when I started competitive programming.
This is entirely natural and expected if you practice the wrong way or have too many expectations in the beginning. In this article, we will talk discuss some actionable tips which you can follow to make sure that your motivation levels are super-high.
Decide Your Goal And Timelines
Fix your goal and decide why you want to do competitive programming. After fixing your goal, you should decide on a realistic timeline for your goals and track your performance improvement against that timeline. For example, your goal, along with timelines, could be any of the following:
- I want to be good at interview-style problems and crack the interview of top tech companies in 4 months.
- I want to be red at CodeForces/TopCoder in 18 months.
- I want to perform better in ICPC/CodeJam style contests in next 6 months.
Even though you may be tempted to do so, don’t skip this step. This step is super important because of multiple reasons:
- Your choice of goal will influence the website at which you practice. For example, if you have a goal of cracking interviews, then practicing at LeetCode might be a better idea than practicing over at TopCoder.
- The amount of time that you have will decide your practice strategy. For example, if you want to prepare for interviews in 2 weeks, then its better to focus on covering more topics in a short period. Your focus would be to cover the maximum variety of questions and less on covering depth of questions.
Set Your Expectations Right
Depending on your current level, and the strategy you follow and your natural aptitude at problem-solving, you may or not notice immediate improvements within the first few days.
Even if you have excellent problem-solving skills, some goals are inherently hard to achieve and take consistent efforts every day. If your goal is to become red on Codeforces and have just started programming, then don’t think that you can achieve that with only 2 months of practice.
If you set your expectations right at the beginning itself, then competitive programming will stop becoming frustrating, and you will not lose your motivation.
Practice Smart Not Hard
raining for competitive programming is like training for any other sports. Quality of your training matters much more than your quantity of training. I see that many people advise to solve problems in decreasing order of difficulty on multiple judges and keep on practicing until you have finished a substantial amount of problems. Practicing this way is plain stupid!
Practicing this way is the fastest way to lose motivation! You will be just practicing a few problems every day without improving your skill or speed.
If you have 1+ month of preparation time, then it is best to do two things:
- Study Algorithms from reliable sources: CLRS Book or good quality editorials on TopCoder/HackerEarth. After reading the topic, try to solve a few “easy/standard” problems on these topics. For example, if you have studied Binary Search, then try to solve a few problems on BinarySearch.
- Take Part In Programming Contests: Regularly take part in competitive programming contests being held on websites like Codechef, Codeforces etc. Regularly take part in only short contests and skip the long contests. Regular participation in short contests would help you in improving both your speed of solving a new problem and coding the solution in a short period. Both skills are critical to success in coding contests as well as interviews.
- Upsolve problems after the contest: After the contest is over, the problems of the contest can be categorized into three categories:
- The problems which you were able to solve correctly within the contest: For these types of problems, look at the submissions of top coders. You will usually find a better/short implementation of the solution which will help you in future contest.
- The problems that you thought you almost solved, but couldn’t solve due to getting the wrong answer / Time limit exceeded etc.
- The problems for which you had no clue on how to solve: Skip these problems for now. Usually, these problems are using some advanced technique/algorithm which you might not know about yet.
If you follow this strategy for even 3 weeks, I can guarantee that you will notice a drastic improvement in your problem-solving skills and speed of coding. Most importantly, competitive coding will become fun for you and you will not lose motivation.