Competitive programming is a mind sport where programmers solve puzzle-like problems with solutions adhering to specified criteria.
These criteria are usually bound by time and/or memory constraints. Speed is the driving factor for competitive programming—the faster you submit your solution, the better your chance at winning.
You also get to inspect and find fault in other people’s code, fetching you brownie points. Topcoder, CodeChef, and Codeforces are some popular examples of websites offering practice arenas for competitive programming.
Competitive programming is most popular among college or high school students, given the skills needed and the thrill it offers. A keen interest in solving mathematical puzzles and problems with a huge amount of practice is the key to succeeding at such contests.
Just like any other sport, the golden rule in the competitive programming world is to start as early as possible. Competitive programming stalwarts and role models like Petr Mitrichev had already won the Topcoder Open (world championship in competitive programming) by the age of 20.
Despite immense popularity among students, competitive programming hasn't received interest from professionals and experienced engineers. Peter Norvig, director of research at Google, went on to say that being good at competitive programming, in fact, negatively correlates with doing well at work.
In this post, I will show you what competitive programming is about and why it can be important to you as a professional programmer. We'll take a look at the reasons competitive programming is often snubbed and also why you should still practice it.
Why Competitive Programming Fares Poorly Amongst Professionals
Some of the most popular factors not working in favor of competitive programming are:
Deals With Hypothetical Problems With Little Relevance to Real-World Challenges
“Picture a scenario where you have an infinite supply of tiles with numbers written on them. Two tiles merge to form a larger-number tile when they have the same number written on them. Your objective is to find the expected number of moves to reach a given number on a tile.”
This is a typical problem in competitive programming where you are battling to run the code on specified inputs within one second and consuming only 50KB for the code you write!
Now, contrast this with building a note-taking app where you make product and design decisions such as user flow, UI elements, and features to be included. Building such an app requires you to slowly and patiently toil your way through code.
Competitive programming problems are typically mathematical puzzles where you are battling constraints that practically don’t bother you much in the real world. The factors that matter when building real-world applications like designing robust systems, user flows, etc. are rarely tackled at all in the competitive programming world.
Skills Not Applicable Directly to What You Do at Work
A typical problem in the competitive programming world would require you to comprehend the problem statement quickly, think of a logical solution, and code it as fast as you can. With sufficient practice, this makes you equipped with great comprehension skills, high aptitude, and the ability to think fast logically.
While the above are quite attractive traits and can generally make you more adept at problem-solving than most people, they do not directly correlate to achieving success at work.
Ask any experienced engineer what it takes to succeed at building great products, and the skills you will hear would be mastery over tech frameworks and patterns, design thinking, and persistence, among others.
Consider this simple example: You are tasked with building a platform like remote.tools, where users can post products, upvote, and comment. This would typically take anywhere between two and four weeks to complete (a minimum viable product or first version).
What skills do you think will help you build such a product? Will it be your high aptitude or your depth of experience in a framework like Ruby on Rails? Will it be your ability to logically think fast or your grasp on design patterns or ability to write crisp, clean code?
In effect, although aptitude and ability to think fast are great generic skills, they cannot replace in-depth knowledge of specific systems and methods.
Requires an Entirely Different Approach or Process Than Building Real-World Products
A Single Round Match (SRM) on Topcoder is typically two to three hours long. The first part of the match is reserved for individual programming, while the second opens up the arena for you to view and challenge others’ solutions.
Seasoned players are able to quickly relate the current set of problems to a past problem or an existing algorithm; they have short code templates handy to use for common-use cases, and they are very well aware of where to look for loopholes when viewing someone else’s code.
Now, contrast this with your typical day at work. Let's say you are tasked with implementing the new design for the signup page on your product.
The most natural course of action would be to refer to online docs for the frontend library or a related tutorial and then start coding. While doing so, if you encounter any issue, you go back, read up on the same, and code it.
The typical cycle for any professional engineer is research, analyze, and code—which is unlike what you do at any competitive programming contest.
Why You Should Still Practice Competitive Programming
It seems we have put forth a very strong case against competitive programming. Looks like it isn’t worth considering for any professional programmer. Or is it?
Let me now touch upon the benefits you may derive by practicing competitive programming, even if it is a tiny bit daily.
Helps You Solve Really Complicated Problems
In competitive programming, you get to practice extremely challenging puzzles involving advanced mathematical concepts and algorithms.
Take the Topcoder tutorials on line sweep algorithms and computational geometry as examples. It is no mean feat if you are able to successfully solve these problems (in a contest or when you practice), and it will give you great joy to be able to crack them!
While you may not find instances of direct applications of these concepts in your daily work, they definitely prepare you to grasp new concepts or master new areas quickly (e.g., learning a new programming language or framework).
Makes You Write Code Fast and in a More Focused Manner
A typical Topcoder SRM has two phases—the coding phase, which lasts for 75 minutes and where you solve two problems with varying difficulty, followed by the challenge phase, which lasts for 15 minutes and where you find errors in others’ code.
Clearly, speed matters a lot when it comes to competitive programming. You need to think and act fast while also coding in a focused manner given the time constraint.
With practice, this helps you stay calm and focused in a stressful environment while improving your logical thinking and coding abilities. This is an extremely powerful trait that not only applies to your work but also benefits you in personal life.
Powerful Exercise for Your Brain
Solving challenging puzzles in a fast-paced environment is definitely a great exercise to boost your gray cells! Be it a live contest or a set of practice problems done at leisure, you are sure to utilize a lot of your brain power doing it.
Your daily work may become mundane in phases or in its entirety after a certain period. Amongst other problems, you may fall into the habit of staying in your comfort zone and not exercising those gray cells. Practicing competitive programming on the side is definitely a great way to constantly challenge your thinking skills.
Makes You a Hot Lead for Major Companies
Be what may, the best of software companies still value candidates based on their technical aptitude (and competitive programming skills, implicitly or explicitly). While a firm may not judge you based on your ranking on portals like TopCoder or CodeChef, you are bound to face challenging algorithm problems in one or more interview rounds.
Even high-quality freelancing platforms like Flexiple and Toptal consider technical aptitude a good proxy for general smartness and include it as part of their screening process.
De-Stressing and Fun Activity
Finally, not everything you do has to bear fruit in terms of career progression. Practicing competitive programming is a great deal of fun, much like solving a Rubik's cube or Sudoku. It also acts as a great stress reliever.
Everyone stresses on the point to have a hobby that helps you build creativity, release stress and most importantly, have fun. Competitive programming may very well become your hobby!
Wow! This isn’t a bad option after all. Competitive programming is like gymming. Does it directly help you grow in your career? Maybe not. Is it beneficial, and would you still go for it? Maybe yes.
Spend Your Time Wisely
Competitive programming in itself may not necessarily help you directly to grow in your career. However, it brings in a set of advantages to qualify as a great, complementary hobby that could sharpen your programming skills. And, it may open doors for you to lucrative positions at top companies!
In conclusion, you choose how to spend your time. Remember, you get only limited time away from work. You can decide to spend it practicing competitive programming problems, or you may take time out to work on a solid side project, mastering a complementary skill like HTML/CSS (for backend devs) or learning a new technology altogether.
Each of these choices has its own advantages and disadvantages, so you need to choose wisely. Whatever the choice, make sure you put focused efforts for a sizable period. Only then will you achieve something significant—the golden rule in the programming world.