How to Get Started with Competitive Programming?
Published: 2022-05-25 02:58:17

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: 

- Geeksforgeeks:
Math in competitive programming 
https://www.geeksforgeeks.org/math-in-competitive-programming/, 
Essential math for competitive programming
https://www.geeksforgeeks.org/essential-maths-for-competitive-programming-course-by-geeksforgeeks/
- Stanford Edu : 
Number theory
https://crypto.stanford.edu/pbc/notes/numbertheory/
- Karthik Arora :
https://www.youtube.com/playlist?list=PLb3g_Z8nEv1i6NHntG5l2fPKuVu853EYy

#### 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++ : 

- Learn C++ from Scratch : https://www.educative.io/courses/learn-cpp-from-scratch
- C++, Short and Sweet, Part 1 : https://www.udemy.com/course/cpp-short-and-sweet/?LSNPUBID=JVFxdTr9V80&ranEAID=JVFxdTr9V80&ranMID=39197&ranSiteID=JVFxdTr9V80-MOhgW1WT4LfwYLz7z5TE8g&utm_medium=udemyads&utm_source=aff-campaign
- C++ For C Programmers, Part A : https://www.coursera.org/learn/c-plus-plus-a?irclickid=11y3n4VhUxyIWTnT9UWYk2-bUkDxy3z3F2duTE0&irgwc=1&utm_medium=partners&utm_source=impact&utm_campaign=3294490&utm_content=b2c

- C++ Tutorial for Complete Beginners : https://www.udemy.com/course/free-learn-c-tutorial-beginners/?LSNPUBID=JVFxdTr9V80&ranEAID=JVFxdTr9V80&ranMID=39197&ranSiteID=JVFxdTr9V80-f3f8GHdogXSNvh70K_odOA&utm_medium=udemyads&utm_source=aff-campaign
- C++ Programming course - Beginner to Advanced : https://youtu.be/8jLOx1hD3_o

#### 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](https://www.spoj.com/) : It is a problem Archive(recommended for all beginners).
- [CodeChef](https://www.codechef.com/) : It has more complex problems and one of the best coding platform out there.
- [LeetCode](http://leetcode.com/): It is recommended for both beginners and advanced coder's.
- [HackerEarth](https://https://www.hackerearth.com/) : Recommended for beginner's
- [HackRank](https://https://www.hackerrank.com/) : Recommended for beginner's.
- [Codeforces](https://codeforces.com/) : 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.