How to Prepare for Competitive Programming?
A step-by-step beginner’s guide to becoming a 5-star coder.

“How to get a job at tech companies like Google, Facebook?” Or should I search for “How to crack interviews at top product-based companies?”
I don’t even remember how many times I googled these phrases, or should I say how many times I doubted my search history. After hours and hours of digging on google, I finally found one of the powerful roots of getting placed at big tech companies, and guess what?
It’s none other than…Competitive Programming!!
According to Wikipedia, “Competitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications.”
In Competitive programming, you can participate and solve the coding challenges, but your competitors are not your small friend circle like in those childhood games in this game. Your competitors are sitting all over the world.
Sounds exciting or scary?
Whatever it is but trust me, taking part in it, winning the contests, and feeling like a competitive programming king will be an amazing experience for you. Not just for fun, but also it will help land up a job in top tech product-based companies (Google, Microsoft, Amazon, Uber, Snapdeal, Goldman Sachs, etc.) on higher packages.
So, How CP Can Help Us To Get Our Dream Tech Job?
- Publicly demonstrate your skills.
Competitive programmers are known for their problem-solving skills. As developers show their skills by doing different projects, competitive programmers show their talent by taking part in different challenges like Codeforces, Codechef, etc.
Competitive programmers build their name and earn fame on these sites, and as they perform well, people start to recognize them.
- Prepare you for a Technical Interview
As you get used to solving harder and harder problems in contests, you will easily answer questions asked in the technical interviews. Competitive programming also increases your problem-solving speed, which provides an edge to you over other applicants.
- It makes you desirable Candidate for major Companies
Big companies like Apple, Google, and Facebook want talented and smart people to work with them. These companies keep an eye on those programmers who outperform worldwide in the contests that take place at the world level. You will definitely get an opportunity to work with these companies if you perform well in world-level contests.
- Teaches you how to work in Teams
Many contests that take place involve team participation also. There you start to learn to approach a situation in a group. It helps when you are working in a company and doing work on a project.
- Guaranteed Brain Exercise
By regularly practicing with competitive programming problems, you can ensure that the coding part of your brain receives a regular workout. It’s like one of those brain training apps, but for real skills.
So, without wasting our time, let’s dive straight into how to prepare for competitive programming from scratch:
Step#1 Learning Basics Of Programming Language
“The most disastrous thing that you can ever learn is your first programming language.”― Alan Kay
The first step of getting into the programming world is to learn a particular programming language. Learning a programming language is just like learning the alphabet to write something.
There is no need to learn more than one language. Knowing the basics of only one programming language would be enough. You can learn C++, Python, or Java.
It will be good if you pick C++. Why?
- Because C++ has the STL, which has Set, Map, Vectors, etc., these can help solve certain kinds of problems.
- It is faster than Python and Java. Here, faster means the code execution time is less. You will encounter many problems where the same code in C++ gets executed within the time limit, whereas Python and Java fail to.
What should we learn for the basics of the language?
Well, some basics differ from language to language, but the common basics you should know are:
- Loops, If-else, Switch
- Recursion
- Data Types
- Keywords, Numbers, Characters
- Searching & Sorting
- Identifiers, Functions, Variables
- Operators
- Array, String
- Input and Output Operations
If you choose C++, then the basics also include OOPS:
- Object & Classes
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
- Overloading and other basic stuff….
You can refer to youtube channels for learning the basics:
You can take online courses from Udemy, Coursera, and other online platforms to master your basic skills.
Step #2 Practice On HackerRank
After you’re comfortable with programming languages' basics, it’s time for you to practice questions on those basics. There are many websites to start your competitive coding journey, but you can use HackerRank. There you can practice some of the basic programming questions of your chosen language.
I recommend Hackerrank because:
- It has the best User Interface, combined with the relative ease of getting started for beginners.
- HackerRank has a good set of problems for beginners placed in a well-defined manner according to the tags and difficulty levels.
You might get stuck after the 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.
Your goal in this step should be to master the language you choose to do competitive programming.
Step #3 Get Your Hands Dirty In Data Structures & Algorithms
Once you are done with the basic language problem, you will gain little confidence, and then side-by-side while you were practicing basic questions on HackerRank, you can also start with data structures and algorithms.
The basic building blocks of DSA are:
- Arrays
- Linked List
- Stack
- Queue
- Tree, Trie
- Graph
- Algorithms
DSA is the heart of programming, and you can not ignore it while solving coding problems in competitive programming. The most important thing you need to know what, when, and where to apply them.
There are several popular options for learning DSA:
- Stanford courses on Coursera
- MIT course on YouTube
- Algorithms (another book)
Step #4 Participate In Programming Contests
Platforms like CodeChef and Codeforces are good for practicing competitive programming. 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 can 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.
Participating in contests on these platforms will boost your confidence, but it’ll increase your ratings, which will increase your odds of getting placed in the big tech companies.
Other platforms(other than Codechef and Codeforces) practice programming contests like HackerEarth, TopCoder, Leet Code, Google Codejam, and Facebook hacker cup.
Step #5 Practice, Practice, and Practice…
Patience, dedication, and consistency are very important to become a good competitive programmer.
1. Brutal Practice
Practice each question of a particular topic that you’ve studied to make your concepts clearer. Practice as many questions you could find related to that particular topic every single day.
2. Learn From Your Mistakes
Don’t say, “This problem is too hard for me, I will try the next one”..that’s the loser mentality.
Learn from your mistakes, review your questions. Don’t just sit like a dumb and move on to the next question if you didn’t get the right answer to the first question. Try again and again until you get the right answer.
3. Upsolve
Let us suppose you’ve participated in programming contests, and you’re able to solve 3 questions out of 6. Then it’s your duty to make sure that after the contest ends, you try to solve other remaining questions solve.
Don’t skip the questions.
CodeChef & Codeforces Platform Details
CodeChef
CodeChef organizes 3monthly contests:
- Long challenge — 10 days
In a long challenge, you’ll get 8–10 questions to solve within 10days. You might think that 10 days are more than enough to solve just 8–10 questions, but the thing is that the questions you’ll get will be of very good levels, and you might or might not be able to strike the solution easily.
So, in that case, you’re given 10 days to analyze your problem, research properly, and strike your solution.
- Cookoff — 2.5hours
In this challenge, you’ll get 4 or 5 questions, and you’ll have to solve them in 2.5 hours. The benefit of the short challenge is that you’ll learn to manage the pressure of submitting your answers within a short time frame.
- Lunchtime — 3hrs
Lunchtime is similar to a cookoff challenge; in this challenge also you’ll get 4 or 5 questions to solve and submit them within 3hours.
On the based of these challenges, you’ll get ranked. And if you got good rankings, then your ratings automatically increase, and as the rating increases, you get stars.
For example, if you’re a 3-star coder, then it means your rating is greater than 1600, and if your rating is more than 1800 then you’ll get 4-star, and if your ratings are greater than 2000 then you’ll get 5-star and so on…
CodeForces
In the case of CodeForces, you will need to take part in a rated Codeforces contest. Roughly you can find 2 or 3 contests every week.
According to your performance in that particular contest, your current rating will increase or decrease. The rating depends on the number of questions you solved, and time is taken to solve the question, and the number of wrong submissions you made.
So, take care of all these while participating in any contest.
According to person ratings, ranks and titles are given to him/her.
For example, if you’ve got ratings between 0–1199, then the title of ‘Newbie’ will be given. Similarly, if the rating is between 1200–1399 then the ‘Pupil’ title is given, and so on…
Being a competitive programmer with good ranks will make your resume more powerful, and the odds of you getting hired by tech companies will increase.
What are the main topics you should learn for competitive programming?
Well, basically, there are n-number of topics for competitive programming, but below is the list of main basics and advanced topics.
BASICS:
- Loops
- Recursion
- Arrays
- STL-Vectors, Stacks, Queues, Sets, Map
- Heaps
- Hashing
- Searching And Sorting
- Greedy Techniques
- Dynamic Programming
- Number Theory BAsics
- Graphs
ADVANCED:
- Number Theory Advanced
- DP on trees
- Segment Trees
- Fenwick Trees
- Geometrical and Network Flow Algorithms
- Expected Value Questions
- SOS DP
- *Heavy Light Decomposition
- *Fourier Transform
If you want to go in-depth, you can find a list of other topics here.
Thank you for reading.
Happy Coding:)





