Competitive programming (CP) is a paradigm in which you design algorithms using your favourite programming language to tackle particular problems. Once a solution is implemented, you submit your code to a test system that verifies its correctness. If there are any failing tests, you analyse your code, re-design it and re-submit a solution. At the end of competition, all participants are ranked based on the total scores of the tasks that they managed to solve correctly.
I started participating in programming competitions when I was in high school, shortly after I began studying informatics. In my country, we have four national competitions during the school year as well as three rounds of the National Olympiad of Informatics. In addition to all of those events, I have taken part in other online programming competitions: both national, organised by CodeIT and international, thanks to platforms like Codeforces and Hackerrank.
Although I am not a CP guru, I still, to this day, enjoy participating in programming competitions. There are so many interesting and challenging problems that, in my opinion, you can never say: “I have seen it all.” when it comes to competitive programming.
Today I work for a software development company. So far, I have had the opportunity to be part of four development teams. I have been working on projects using different technologies, programming languages and tools such as Java EE (Enterprise Edition), ETL (Extract Transform Load) Architecture Framework, Spring Boot, Angular, C++, Docker.
To begin with, both CP and regular work in a software company involve a lot of hours spent coding. You still have to write functions that take input data, do some calculations (may or may not directly use algorithms) and return output data that is used in another function or printed somewhere.
Kickstarting my software career with competitive programming made it easier for me to love programming in the first place. All it takes to get started is to install an IDE (Integrated Development Environment) and a compiler, and you are ready to tackle algorithmic problems.
Furthermore, it does not take that much time (even if you are a complete beginner in the field) to start solving arithmetic or array problems. By doing so, you build confidence and are motivated to continue with harder, more challenging problems. In time you learn more difficult algorithms and improve your coding skills in general.
Once you have invested enough time into competitive programming, already having this enthusiasm for coding, the transition to enterprise projects as part of a team of developers happens more smoothly.
All this progress comes without the tedious process of configuring required environments, tools, frameworks etc. (which is inevitable in real-life projects) and helps you preserve the passion for the actual coding.
Anyone who has started a software career knows how intimidating it is to get into development straight away. That being said, taking small challenges at a time, at your own pace, can help take away some of the pressure.
There is a lot that I have learned from competitive programming as a developer and is beneficial for my everyday work. Here are some examples:
- Improved interview performance
First of all, to get onboarded to enterprise projects in a company, you have to pass an interview test. Usually, it contains at least one algorithmic task, and this is where CP comes into play. You feel more comfortable during the interview when you have competitive programming experience.
My interview for the company where I work now began with an algorithmic problem to swap elements in an array in a certain manner. Solving it gave me confidence which I believe improved my overall interview performance.
- Enhanced problem-solving skills
It is a well-known fact that competitive programming helps a great deal when it comes to boosting your analytical and rational thinking. CP improves the ability to come up with quick and easy solutions which is a desirable skill in any software company. Furthermore, since debugging is a common part of both competitive programming and enterprise projects, having a background in CP is useful in this field of work as well.
- Get familiar with antipatterns
The nature of competitive programming requires writing algorithms fast, and in most cases, the result is poor code quality. However, in real-life projects, nobody will let you write ‘dirty’ code (or at least should not) considering that projects tend to grow very large and become impossible to maintain if they are poorly written. That is why it is essential to write clean code.
Although reading books on the topic and following certain rules when programming is the way to go, having already seen some antipatterns in your own programs definitely helps understanding better what to avoid.
- Cope with stress
Some scoring systems during competitions evaluate task solutions on varying criteria. For some, aside from turning in a working algorithm, you are also timed as to how long it took you to develop it.
Thus, you are constantly under stress not only to submit a correct solution but also to do it as fast as possible in order not to lose too many points. As a result, you are trained to produce better results under pressure.
The equivalent when working on real-life software products is having to cope with tight deadlines, fixing issues and testing at the last minute before demo with clients. In situations like this, competitive programming experience allows you to remain more focused and achieve the required results on time.
- More efficient teamwork
It is not uncommon for programming competitions to allow working in teams so that you and your teammates can solve more complex problems for a shorter period of time. There is a catch, though. In some cases, the team is given only one computer and a single copy of each problem statement. These restrictions require the team to efficiently distribute tasks between the members by knowing each other's strengths and weaknesses. The same thing applies when you are part of a software development team.
In conclusion, if you are intrigued at least a little bit with competitive programming or just curious what it is all about, my advice is - give it a try. Spend some time working on different algorithmic problems, check for yourself whether you enjoy it.
If this is the case, dive deep into CP, be passionate, and I guarantee the effort that you have put into competitive programming will be beneficial for your software development career.