DEV Community

Cover image for How to Get Started with Competitive Programming?
Munavvar Sinan
Munavvar Sinan

Posted on

How to Get Started with Competitive Programming?

If you're a computer science student you must have heard of Competitve programming. It is skill that will set you apart from the crowd, add more value to your resume and subsequently provide you with an edge over others during placements or other career opportunities. Most of the tech giants like Google, Facebook, Amazon etc. singnificantly consider the competitive programming skills to recruit the candidates.

Most of the computer science students dosen't know how to start competitive programming and what are the best resouces to learn it.
so if you're on of them who doesn't know where to start. This guide will help you to solve your doubts regarding competitive programming.

Table of content

In this guide we'll talk about:

1.What is Competitive Programming?
2.Why Competitive Programming?
3.Where to get started?
4.Common mistakes to avoid in competitive programming as a beginner

What is Competitive Programming?

NOTE : To many, competitive programming isn’t just about typing out code. It’s a sport that takes years to master.

Competitive programming is a sport, perhaps even a form of art. It's an activity that requires creativity and analytical thinking to tackle difficult coding puzzles.
It is a brain game which take place on the internet or a local network in which programmer's have to code according to given constraint's.

Why Competitive programming?

Competitive programming will help you to demonstrate your skills to public .Competitive programmers are known for their problem solving skills. Like developers show their skills by making different projects, competitive programmers show their talent by taking part in different challenges which sites like Codeforces, Codechef, Topcoder, Hackerrank, Hackerearth and many more host frequently. Competitive programmers build their name and earn fame on these sites and as they perform good, people start to recognize them.

As you get used to solving harder and harder problem in contests, you will easily be able to answer questions asked in technical interview.Competitive programming also increases your problem solving speed which provides an edge to you over other applicants.Big companies like Apple, Google and Facebook want talented and smart people to work with them. So these companies keep an eye on those programmers who outperform worldwide in the contests which take place at world level

Where to get started?

All the resources provided in this article will be free to use

1. Learn basic mathematics :

You can definitely start competitive coding without any mathematical background. But maths becomes essential as you dive deep into the world of CP.
Basic mathematic means simple number theory concepts and also being able to solve basic linear equation and inequalities

You can refer to the following links:

2. Learn a programming language :

The most important thing in competitive coding is how good is your programming knowledge and problem solving skills. Having good problem solving skills and knowledge is of no use if you are not able to convert your logic into code.
Now in the case of choosing a programming we have a plenty of options and the best to choose is C++ or JAVA. You can also use python but compared to the run time speed and other factors C++ and JAVA is much more better than python even though python has simple syntaxes.

I would suggest to choose C++ because it is the most widely used language for CP. And also C++ provide you with the fastest run time among all the other languages. Also for problems where you have strict time limit C++ would definitely give you an upper hand. And also if you are coming from a computer science background you would definitely have some knowledge in C language so it would be much easier to get started with C++.

Resources to learn C++ :

3. Learn Data Structures and Algorithms [optional]:

This is an optional step. You might want to learn the most common data structures and algorithms before jumping into CP.
The best way you can excel in CP is by giving direct contest instead of learning DSA. You can learn most DSA simply by solving problems in the coding platforms. In this way you will not only be learning DSA, you will also get a good experience in attempting competitive programming contests. Because learning of all these DSA and not able to use it in contests would be of no help.

Make sure to learn at least the DSA foundation like how to compute the time and space complexity, recursion etc.

4. Start solving problems on popular CP platforms :

After brushing up on all the basics and familiarizing yourself with the DSA fundamentals, it's time to start practicing. Practice is the only golden rule that can make you succeed in the journey to learning competitive programming.

There are numerous platforms where you can find a good variety of competitive programming questions. You can start with websites like SPOJ, CodeChef, Hacker rank, Hacker Earth, LeetCode, Codeforces. Many tech giants consider the ranking of a candidate on these sites during the hiring process.

Start with small problems and go on to the harder ones. Never get stuck on a problem for too long in the initial period. Google out your doubts and try to sort them out or you can discuss with someone.
Even if you are unable to solve the problems do always look at the editorials and then code it and get accepted.
And even if you are unable to do it, do look at the codes of amazing programmers. See how they have implemented and try it in your code in that way you can learn more advanced way of coding.

Links to some of the best coding platforms:

  • SPOJ : It is a problem Archive(recommended for all beginners).
  • CodeChef : It has more complex problems and one of the best coding platform out there.
  • LeetCode: It is recommended for both beginners and advanced coder's.
  • HackerEarth : Recommended for beginner's
  • HackRank : Recommended for beginner's.
  • Codeforces : Best for competitions.

Contests are a greatest way to test your competitive programming skills. You get to compete with CP enthusiasts like you and even with some experienced programmers throughout the globe.
Participating regularly in such challenges and contests boosts your confidence and provides you the opportunity to get noticed by various tech giants who directly hire top rankers from such contests.

5. Improve your typing speed [Optional]:

As you are taking part in competitions your typing speed must be good or else you cannot make out in competitions with strict time limits.
So improve your typing speed as you moving on.

Common mistages to avoid in competitive programming as a beginner.

Here are some common mistakes to avoid in competitive programming as a beginner.

  • Avoid focusing too much on one programming language.
  • All practising, No learning.
  • All learning, No practicing.
  • Only participating in contests.
  • Giving up

Everything cannot be done overnight. You have to be focused on your learning and practicing problems.

I hope this guide will give you a clear understanding of what competitive programming is and how you can get started with competitive programming.

This guide is referred from Priyansh Agrawal (AIR 1 in Google Kick start and candidate master in Codeforces) and Codeforces.

Thank you.

Discussion (0)