Thursday, July 9, 2020

How to start Competitive Programming?


Illustration Image

There are thousands of answers to this question and honestly none of them are wrong. I guess you should stop looking for more answers and start following one of them earnestly and whole heartedly.

So, let’s start with a step by step guide to competitive programming:

  • Mastering a language: The most obvious step. To learn a language, you may go through a good book or opt for a video lecture. It is important that you finish the book / videos you have started. I personally recommend starting with C++. You may also take up C, Java or Python.  However, some Olympiads do not allow the use of python. When you start programming more often, you will get accustomed to important syntaxes and paradigms.

You can practice questions on any topic at Hackerrank. Here you will find brief yet crisp description of a topic and lots and lots of questions. You may also visit GeeksforGeeks for a quick or a detailed explanation to any programming related doubt.

  • Brushing up your thinking abilities: This is not an actual step but one can’t help but mention its importance in competitive programming. If questions are easy, they are not competitive. Also, there are several ways of solving a question but when it comes to a competition, your code must run within the given time. This can be done only by using proper math and algorithms.
  •  Learning Data Structures and Algorithms: To my knowledge this is one of the most important part of competitive programming. It separates an ordinary coder from an extraordinary coder. Without the basic knowledge of time complexities and use of data structures, one cannot go ahead with competitive coding. Building up a solid algorithm for a question is the first step to solve a question.
  • Appearing in coding contests: Once you have learnt a language you may hit the contests straight up. At first, I recommend you to go for practice questions on Codechef. This will make you comfortable with the online IDEs and will help to get an estimate of the difficulties of a problem. (It is not necessary that you code on its IDE.) There are three monthly contests on Codechef:

i.                Long Challenge: It is a ten-day long contest. Beginner should take this up more seriously.

ii.              Cook off: This is of 2hrs 30mins. It checks your thinking and coding skills in the stipulated time.

iii.            Lunch Time: Its duration is three hours. In both cook off and lunch time, time is of maximum priority.

Once you are comfortable doing contests, you may also try from the plethora of contests on Codeforces. Codeforces boasts a number of almost weekly scheduled short contests of three hours that will help you take the extra step in enhancing your immediate thinking and effective coding skills.

 

Some extra tips:

  • It is vital that you maintain your patience. Competitive programming is an art which is not easy to master. Being a beginner, I understand that it must be devastating to not be able to solve a question after a dozen tries. An AC verdict (solution accepted) after the thirteenth try can surely make your day.

    There are no limits for practising. Aside from the above mentioned links you can also find good questions on Hackerearth and Spoj.
  • Programming is like a sport and cheating will only improve your score, not your performance.
  •  It cannot be that your code is the same as your friend’s code, yet his/her code runs and yours does not. Stop convincing yourself by saying this. Instead, after every contest be sure to visit the editorial sections to check the solutions of the questions that you could not answer.
  • This book was recommended to me by a friend: Competitive Programmer’s Handbook. It has helped me a lot.

 

As said before competitive programming is like a sport, and like mastering any other contest it requires a lot of hard work, courage and most importantly patience.

Happy coding.

As always your valuable comments and suggestions are welcome.


The views expressed are personal and belong to the author.

This post has been written by Pratyush Dev.


8 comments:

  1. Very helpful and nicely written bro. Good work

    ReplyDelete
  2. Nicely written..really it will very helpful...hope we will see more blogs ...

    ReplyDelete
  3. Sir,how can we improve our problem solving skill on
    dynamic programming?

    ReplyDelete
    Replies
    1. Please don't call me sir. This video series helped me a lot in dp : https://www.youtube.com/playlist?list=PL_z_8CaSLPWekqhdCPmFohncHwz8TY2Go
      Yet when a question pops, you will have to come with a way to approach it. This comes with practice only.

      Delete
  4. Nicely written!!! Keep up the good work.

    ReplyDelete