Disclaimer: This article was written few years ago and may no longer be relevant as software engineering has changed a lot in the last few years. This is what may be more relevant now: Future of Software Engineering - Gaurav ChandakCompetitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications.
Contestants are referred to as sport programmers. Competitive programming is recognized and supported by several multinational software and Internet companies, such as Google and Facebook.
If you are a beginner and are thinking of starting or have already started with this amazing, brain-storming sport, this post is a must-read.
I started competitive programming in 2nd year of my engineering. Like many other beginners, my main aim was to get better at problem-solving along with other aspects of technical interviews for product-based companies. I thought that it would help in getting a good placement. Soon the sport itself became fun with so much to learn and achieve.
However, unlike other subjects, this was not something for which I could buy a book and become an expert in a short time. It is a long and continuous process of failing and learning.
I have written down some common mistakes which I committed or saw others commit while beginning with competitive programming.
Focusing too much on the programming language
One of the basic mistakes that I have seen many aspirants make is investing too much time in deciding the programming language they should use for competitive programming. There are lots and lots of articles about why CPP is better than Java (or vice versa) for competitive programming, the number of libraries Python has, how fast CPP is, and so on.
But it does not mean, if you choose Java, you cannot outperform a coder in CPP/Python. There are top competitive programmers who use Java, CPP, Python, and other languages as well.
In the end, what matters is how effective you are in implementing your logic in any programming language. As long as you are able to do that, any programming language could be the best one for you.
All practicing, No learning
When I started with competitive coding, I thought just solving problems was the key to get better.
So I started trying out questions from HackerRank and in a matter of a month I solved over 100 questions. It really boosted my confidence. However, in the long run, I realized it was not the right way to do it. Becoming better in competitive programming is not all about solving problems. You are bound to get stuck at some point, and unless you learn related topics there is no way out.
For instance, if there is a question that requires lazy propagation of a segment tree, no matter how well you know a normal segment tree, you cannot implement it. It is important to keep learning new algorithms, data structures.
In the long run, when you have knowledge of a sufficient number of data structures and algorithms, you will be able to determine the logic of most of the questions just by reading them.
All learning, No practice
The other wrong way that I have seen people going about data structures and algorithms is by learning them through books, blogs, or posts and not actually practicing questions based on them. Sometimes not even coding the data structures themselves thinking it's too complicated and that it would be best to just copy-paste it whenever required.
I did the copy-paste part until I had to implement it from scratch in a live contest. I had to fix a number of corner cases before reaching the final solution.
So, knowledge of a topic is of little value unless you can code it during a live contest or an interview. Most importantly, you have to know when and where you have to apply it.
For instance, binary search is one of the first algorithms one reads but still I have seen students failing to realize a question is based on binary search in my webinars.
Only participating in contests
One of the best things about competitive programming is that it provides a significant number of opportunities to showcase your skills. There are many contests which occur at the national and international level which can help you gain recognition in a matter of days.
But here is where aspirants get mistaken. You have to practice before you can actually reach a level where you are recognized. I have seen people hopping to contests after some level of coding and once they are getting good results, they stop practicing. They code only during live contests so the learning is limited to those contests only.
This is an incorrect way to carry on competitive coding unless you are happy with the stagnant results.
Not participating in contests
If you keep practicing and never actually participate in a contest, there is no way you can evaluate your performance. Contests help us understand our position in the real world. They help us evaluate our hard work by competing with others in the same field.
Solving a question during a contest is a lot different than solving it in free time. Being time-constrained while withstanding the pressure by the competition from the fellow participants actually shows how effective you are.
Solving random questions
One of the common mistakes which not just beginners but also some advanced programmers make is going about chasing random questions. It's true that in competitive programming success resides in knowing different algorithms and being able to solve the diverse sets of questions.
That being said, if you just go about solving random questions, it will be nothing but a wild goose chase. Unless you have a plan to understand problems in one category, the improvement will not be significant.
It all boils down to the fact that most aspirants prioritize contest ranks over self-improvement. Initially, the goal shouldn't be to improve ranks by hook or by crook. In fact, the focus should be on learning topics and being able to solve questions pertaining to those topics.
Giving up
"I cannot do it"
"It's not my cup of it"
"It's too difficult to solve more questions after a point"
Well, I have heard all of these excuses. I know people who started programming with me but gave up somewhere in the middle. They were unable to improve in terms of rank in contests and were stuck after solving a limited number of questions repeatedly.
Yes, it can get frustrating at times. I have been in situations where I spent a number of hours trying to solve a question without reaching an optimal solution. There will always be questions that you might not be able to solve. It does not mean that you should just give up. It does not equate to failure. In any case, you will learn a new concept thereby progressing in your CP journey.
A piece of general advice would be to always look at the editorials to learn new concepts and to understand why you were unable to solve it.
Join our discord community to have healthy discussions on programming, interviews and job search.


