Competitive Programming Starting Guide
Competitive Programming Starting Guide
“Connaught Place isn’t the best place to find bug so the CP is where I go”
Competitive Programming (CP) is like a sport and many do it for just fun. If you are into programming,
you can give it a try!
Computer Programming is a process to solve real world problems with the help of a computer (a
dumb tool to perform lots of repetitive tasks, efficiently) and Human made Algorithms.
On the other hand, Competitive programming is a kind of mental sport where you have to solve
problems within certain constraints.
In Competitive Programming (CP) there is always a judge, which runs your program on several inputs
and validates it. You get a verdict based on how your code performs on the test cases.
(can remove)
AC (Accepted) - Rejoice! Your code passes all test cases given by the judge and is deemed
correct.
Time limit ( about a few seconds ) - You get a verdict of "Time Limit Exceeded" if your
program doesn't terminate in time.
Runtime errors - These occur when your code is prone to faulty pointers and stuff. Keep an
eye if your code breaks for large inputs.
Wrong Answer - This means that your code produces incorrect output.
Constraints on input - most important, this gives you an idea about how fast your algorithm
should be.
Compile a code and submit, you may get a WA (Wrong Answer). Hunt the bugs (make changes to
code) and eventually you will get your first AC.
Hackerrank: has a very good section of tutorials aside from contests. Practise problems
are topic wise.
Hackerearth: Best section of tutorials and blog to which can help. It also hosts
Hackathons which are very helpful and hiring contests.
CodeChef: hosts 3 contests Long, Cook Off and Lunchtime which is its forte. Aside from
that it also hosts contests for various colleges and also ACM style contests.
Codeforces,SPOJ,Topcoder: they have some good level of problems and best
distribution of them according to DS or algo used.
How to Start?
The whole Idea of CP is based on 4 main pillars Programming Language, Algorithms, Maths, Data
Structures.
You don’t need to know any “fancy name” algorithm or data-structure to get started.
Understand the input values carefully & expected output and its format
Levels Up
To start in this field you just need some basic knowledge of any programming language.
About 20% of questions in a programming contest are simple conversion of basic english to a code in
your favorite programming language. So Start by solving 10-15 basic level Questions where mostly are
just conversion of English to Code.
When you get familiar with Environment of CP then start learning some basic Algorithms like
Searching, Sorting, Prime Num Generator, Number Games, Modular Arithmetic and Modular
Inverse.
Then go to the easy level and do at least 10-15 question of easy level.
Sometimes problem do not directly say to apply some of these algorithms, problems appear complex,
you just need to figure out what, when and where to apply them.
After this, you are prepared to appear for Online programming contests, but you might be able to
attempt only 1 or 2 problems.
Now you need to know some actual Competitive Programming skills like Trie, Segment Tree, map,
pair, BST, Hashing, Dynamic Programming, sieve of Eratosthenes, 0-1 Binary Search, Bellman Ford.
Why do we?
Many programmers argue that competitive programming do not relate to the real world programming
Stuff. To a point, yes it is true but
It makes you think out of the box, which help you to develop better ideas in real world
Programming.
iTie you up with the time constraints and ask you to right efficient code, which make yourself
ready to survive & win in the real life technology competition.
Improve your Critical Thinking Capability, which help one in debugging at crucial time.
Teach you how to break the code into chunks and then apply Bottom up Approach.
Makes you a desirable candidate to major companies like Google, Amazon,
Facebook.
Opportunities
Now a days, almost all major companies are hiring candidates through competitive programming.
They conduct their Qualifier Online as a Programming Contest and then select candidates based on
their performance. Some of them are :
CodeVita: TCS conducts codevita, competitive programming contest and hire candidates. There are
3 Rounds, first 2 rounds are online and last one in Onsite based on Competitive Programming.
HackWithInfy : Infosys started this competition in 2018 and hire student for different profiles
according to their performace. There are 3 Rounds out of which first 2 rounds are based on
Competitive Programming and Last Round is an Interview Process. This year 4 Student directly got
placed in Infy from MITS through HackWithInfy .
Google code jam and kickstart: international programming competition hosted and administered
by Google. There are total 5 Rounds and the top coders get chance of Interview in Google.
CodeSprint-Amazon: CodeSprint Amazon India is a 2 week long coding contest where you can
apply for Amazon. It will have 4 problems and last time conducted on Hackerrank.
X-perience:
Efficiency and Speed are the two most Important Criteria of CP.
Sometimes You will come to a situation when you simply translate the code but Got TLE. Then you
have to apply some algo and presence of mind to solve the same problem with some efficient logic that
will lead you towards AC.
There may be many ways to solve the problem, you may get some way to crack it but still not succeed
in getting “Answer Correct” may be bcoz your technique is not efficient one. It is the best part of CP,
You know the solution but you can’t succeed bcoz u r not efficient, At this time, do not leave the
question instead focus to find the better way to solve the same problem. Bcoz moving without
improvement just create a bubble around you and you start believing that you are learning something
but actually time is just going away and u r still at the place from where you started.
It feels awesome when you are representing your college fighting with time and limits just to get AC
that pressure, environment and feeling is awesome.
In my starting days of college, once 3 super senior entered into our classroom during Lunch break and
asked about coding then they informed us that a they are conducting a online College level
Competitive Programming Competition. This is the first time I hear this term for the very first time. I
researched over it, made an account on codechef and start coding.
I still remember my first problem is addition of 2 digits and it took 11 submissions to write & submit it
correctly.
Honestly speaking, at that time, I hated this thing and decide not to go further into it.