Getting started with Competitive Programming - Build your algorithm skills

Aug 21, 2018

I started Competitive Programming as soon as I got into college, around 2014.

And I seriously continued with CP till 2015.

My career was only for a year. But I learned a lot during that time since it was my #1 priority.

Before we go any further, you might be thinking why I left CP.

This was because I got interested in open source back then, and creating cool GitHub projects became my new hobby.

Was that a good decision?

That only time with tell. But with the future plans I have, it seems to be a good decision.

So let’s start this guide to Competitive Programming.

Step 1

Learn C, C++ or Java. If you can learn C, you can learn C++ and I will highly recommend that.

Why? Because C++ has the STL which has Set, Map, Vectors etc. These can come very instrumental in solving certain kinds of problems.

I have never used Java but seeing that some pro coders (uwi) like to use it, I think it’s a good choice too.

Again, don’t use Python, Ruby, etc, for CP. These are very high-level languages that won’t give you as much control over your code as is needed. And they are painfully slow.

Step 2

Get on Hackerrank.

I recommend Hackerrank because it has the best User Interface, combined with relative ease of getting started for the beginners.

Ease in the sense that anyone with zero CP/algorithms experience will be able to solve the first few questions.

You might get stuck after first 4-5 questions and that’s normal. In that case, feel free to see the editorial or google to look for the solution.

When you find it, make sure to understand it, and then code it on your own.

First, solve “Easy” questions of all sections, and then “Medium” questions.

In fact, solving some “Medium” questions is good enough to call yourself a CP professional.

Step 3

Get on Codechef and Codeforces.

Codechef long contests are the best in the business, and Codeforces is well known for its 2 hr rounds.

Try to give both and see where you are good at.

Developing your Competitive Programming skills requires that you are both fast and are able to think deeply about a problem.

Codechef long challenges = Deep thinking AND Codeforces rounds = Fast coding

If you want to be good, you should try to be good in both these areas.

But it’s fine if you are just good at long challenges (deep thinking) or just good with short contests (fast thinking), both will help you become a better programmer.

Step 4

You can try Topcoder if you want. Or just let it be.

With CP, if your goal is to get offers from Google HQ and likes, you will have to do it regularly. That is, give contests, try to rank higher, and build your rating.

Otherwise, you can just do it on the side and focus on building other practical skills.

These practical skills combined with your decent competitive programming experience will go a long way in helping you secure those jobs and internships you dreamed about.

Alternative Route

You might already have some CP experience and might be looking to learn some algorithms. In that case, go through this list of algorithms by Codechef. Practicing even the top 20 of the lot will make you an above average Competitive Programmer.

You can also find a good list of algorithms at GeeksForGeeks. They are separated by topics and you can learn the ones at the top OR the ones you have heard about.