top of page
  • Writer's pictureTim Buchalka

What Is Competitive Programming? - Find Out If Competitive Programming Is for You!

This topic has been requested by a number of people who've left comments about this topic on numerous videos on my YouTube channel so I finally got around to doing a post about it today. We're talking about competitive programming. We're gonna go through and find out what competitive programming is and some of the information about how it works. Hopefully, I'll answer for you by the end of this post, whether competitive programming is something that you wanna do or look further into. So without further ado, let's get into that right now.

Today, we're talking about competitive programming.

What is competitive programming? I'd like to use an analogy here so let's think about a sport where you're competing against other people like weightlifting. In weightlifting, the idea is to lift the most weight and you're competing against other people to do that. Over time, people get eliminated if they can't lift a certain weight and eventually there's someone who's left and basically wins because they lifted the heaviest weight.

In competitive programming, we're not using our muscles and we're not lifting weights. We're not using physical muscles but we're using brain muscle or brain power, if you will. We're creating, we're completing I should say, challenges that have been created for us by people who are actually running the competitive programming contests or competitions, in which there are a lot of 'em. That presents you with a problem and you need to solve that problem in computing terms by creating a program to do so. The real kicker here is you need to do it as quickly as possible.

The whole idea of competitive programming is on getting something that works that actually meets the requirements that are given to you. It has to actually solve a particular problem, but also has to be done as quickly as possible. Now quickly as possible in a sense of getting it completed in the amount of time you've been allocated, but there are also other stipulations often there that your solution may have to complete in a certain amount of time.

For example, I might say whatever the solution is, it has to execute and take no longer than one second to do so. You'll find that there's a judge, an online judge, whom you'll upload your version, your solution and they'll go through that and run that and verify that that actually works in this amount of time. Also, how much time you've actually taken to write that is calculated and stored somewhere as well.

It's usually done on a number of rounds. You can start from round one and there might be 500 people competing. The people who don't make it to the end of round one, people who don't finish the solution in the given amount of time or whose solution is incomplete or doesn't work or takes too long to execute, they will get eliminated and then you move to round two. Then there's another challenge and you keep moving through until eventually, you get to a final round and there's a winner award and someone will eventually win that, completing the last challenge that's been assigned to them in the quickest amount of time.

Depending on the type of competition that's out there, you might find that that will take you onto other things and eventually you could even get to a huge competition where there's lots of cash prizes and other sorts of prizes. So it can be quite a thing where you can actually make money if you're the type of person who can really work well under pressure and complete a lot of these challenges quickly.

A lot of these contests or competitions have actually got high score titles and these points that you're owning, it can continually help those appointed or allocated to your account. That means that someone can go back and see the history and they can see the archive, "Oh, Tim has got 5000 points here" and they can compare themselves to you. So this is letter that's available and the secret way to check your progress against other people and see how you're going against them.

Again, the point I wanna stress here is that competitive programming is all about getting something done as quickly as possible: getting it done really, really fast. Sometimes, you'll get to decide on the programming language to use but other times, you'll have to use the language that the person that you're providing the solution to, is saying that they'll receive. They might come back to you and say (for example) "I'm only going to accept C++ and C for a challenge". So you'll need to go in there knowing ahead of time what language to use. Often, they'll accept multiple languages so you maybe have to do a big job of Python, C+ Parcel C.

Keep in mind again, being competitive, it's coming down to time and your solution takes 1 1/2 seconds and another solution takes a second, now if the stipulation was that it needed to be no more than one second long, then you might be eliminated for that. For that reason, often C++ is a language that's heavily promoted but I've seen competitions on all sorts of different languages and you're not necessarily eliminated purely because of your choice of language, but just keep that in mind as well.

Not to mention, there's usually (well, almost always), an online grader who will take your solution. So there's a submission process. You get your code working in your favorite IDE, then you'll copy and paste that, upload it and they'll actually verify that. Once they've verified that it's working, you will then go and post that and you can view the points that you've completed at a certain time. However the calculation is or the amount of time, how quick it is, will be added to your account.

With that said, we now know what competitive programming is. Why would you wanna do competitive programming? Well, as you can probably imagine, you'll probably become a better programmer thanks to this process and you're testing yourself against other (in many cases) elite developers. It can be something that will really put your back to the wall and really they'll help your skills and you'll get better at problem-solving, because you really need to think on your feet and come up with solutions really quickly.

Here's another big one: often, the problems that you need to solve are used as interview questions at large companies like Google, etc. So the more that you understand and are able to compete with these or complete these competitive programming challenges, that's going to help you for technical interviews because you've actually been through these processes, through these questions that are often asked or similar questions at interviews. That's a good way to brush up on those skills if you wanna do that.

So what are the prerequisite skills that you need to have to get into competitive programming? Well, in general, you need to have a really good knowledge of your chosen programming language. This isn't something generally that I recommend for beginners because of the nature of what you're doing here. You're needing to come up with a solution fast, so it means that you should really have a good understanding of programming languages. Also, I would suggest you also need good understanding of data structures because you'll be using those in your solution and probably algorithms as well.

With that said, we've talked about who it's not aimed for so let's now talk about who it's aimed for. I've talked about beginners, whom are probably not suitable. Beginners in general are not gonna be suitable because they haven't really got those core skills that are needed. You really need to have some experience with programming so it's really aimed more at the people who know something about it. They've got a good level of programming skills and are looking to take their results to the next level. They're really wanting to go through this as an exercise so that they can answer technical questions at interviews down the trek and also to become better programmers because the more coding you do in general, the better you get at programming.

One really big advantage of competitive programming is it can be really worthwhile if you like working under pressure. You often get that in your career as a programmer. You may need to think under pressure, you'll need to come up with a solution quickly and that can be a good thing because this is what this is all about. It's all about the clock is ticking all the time and you need to come up with a solution really fast and that can be exhilarating if you're the type of person who works well under pressure. Obviously contrasting that, if you're not that type of person, you don't like pressure, you might find competitive programming is not quite fair for that purpose.

One bad thing though, about competitive programming, is that it can teach you bad skills, believe it or not. When you get a job, if you carry working like you've done now, like a competitive programmer, where you're trying to get something finished as quickly as possible, that can lead to rushing a solution and can lead to bad programming practices. Because in a job in the real world, it's not necessarily just about completing it in the fastest possible time. It's making sure that you're using best practices, your solution works, so it's been thoroughly tested, it works well with an existing code base and so on and so forth.

In fact, further to that, Google have actually come out and said that they've found interestingly enough, that people who excel and win at competitive programming, that can be seen as a negative factor when they actually go for a job. That's for that reason: that basically there's someone's rushing because they're so used to doing that as a competitive programmer. They may actually not be a great fit for a job until they realize they need to slow down and think a little bit more about the process before they actually get to start typing, in other words - thinking of architecting a solution instead of just rushing to finish it as quickly as possible.

There is no doubt you will get better if you go through competitive programming and that's purely the case because you're actually doing more programming and I would suggest - for that reason - it's maybe worth a look. The other thing to keep in mind is that it might even be worth just to try it knowing that you're not gonna try and get to be the best of the best, but just to enter a competition, try it out and just see how you go.

Try not to get too discouraged and just remember that these types of events, contests, and competitions for competitive programming, tend to draw out the elite so you really will be competing against the best of the best in many cases. If you're not getting the results you think you should be getting, just keep in mind that you are competing at that level. It's probably worth a shot but just don't get too discouraged, if you're not getting the results you want.

I see it as something that some people will probably love, particularly people who love to put themselves under pressure but it's certainly not for everyone. So for that reason, if you think you've got the skills, give it a whirl.

Amazing, you made it to the end of this post! Thank you for reading. If you've got any questions, feel free to leave a comment and I'll get back to you.

47 views0 comments


bottom of page