Starting off with Competitive Programming

Amit K S
3 min readJul 6, 2018

--

Hola! This is my debut in writing and I would try to make it short and sweet…maybe 😜. This one is for newbies who have just snuck into the world of competitive programming or want to get into it. If you are already established, you might not want to waste your time. So let’s dive into it, since i already said I would keep it short and sweet. 😆

There would be tons of questions in one’s mind as a beginner. I hope some of them might be answered down below.

The Prerequisites : First of all, you’ll need a programming language you’re comfortable with. Java, C, C++ or Python are preferred. C++ might be more useful when compared to C because of the template library it supports. Is one supposed to master it? Nope, not at all. Just make sure you know some of the mostly used data structures such as an array (list), hash map and maybe priority queue. What advanced algorithms do you need? None. Just a few basic ones, such as the binary search and exponentiation would come in handy.

Where to begin? : There are a lot of websites you can start with. Just DO NOT jump over to the harder questions directly and break your head. Start off with easy, gradually you’ll pick up. Some good websites are Codeforces, Codechef, Hackerrank, Hackerearth, SPOJ, URI Online Judge, blah blah blah….There are tons you’ll get by googling.

How often to code? : This one really depends on you. You may spend some time daily and practice a question or two. The more time you spend practising, the sooner you’ll be better at it! To keep a check on your performance, you might wanna participate in the contests that are conducted once in a while on various platforms. Codeforces conducts contests regularly (very regularly) and one may find it tough at the beginning(unless you are gifted). Hackerearth, Hackerrank and Codechef conduct some monthly contests you may find interesting.

Speed : “Do I have to be the flash?” - No, you are not expected to be super fast at the beginning. Speed is a very very important factor in a short time contest, but it gets developed only when you practice enough. To get a little bit faster from the beginning itself, you might wanna do something about the most commonly used (and long) syntax for loops, taking input, etc… I mean, it would take ages to type scanf(“%d”, &input) several times. You might wanna shorten it to, say, si(input) by having macro definitions (in C). There might be a similar fix in Python and Java too (I am not much familiar with Java and python). You may have something like this, if you are a C++ user.

Where to learn? : Almost all the websites dedicated to competitive programming have their own blogs on various topics. You might wanna google once to checkout. Codeforces has it’s user written blogs on numerous algorithms which are pretty good. Hackerearth has a wonderful collection of blogs and problems sorted topic wise. I might write about a few of them in my further stories! Moreover, you are not supposed to remember the code for every algorithm you learn (I mean, it’s good if you do, but not necessary). Once you get in the flow, you’ll have to know about many algorithms and hence it is better if you store them all at one place and just copy paste it every time you need. You may refer my GitHub repository for some of the algorithms (I would be adding some more updates in the future as I write about various algorithms).

Okay, that’s it for the first post. Hope it was not that boring, was it? 😐 In no time, I hope I would be (probably, if I snap out of my laziness 😆) writing stuff about a few algorithms. Check out this link, you may find something good 😛. I would appreciate any compliments or suggestions about this post, or about my GitHub Repo, or anything. See ya later!

--

--