Disclaimer: This article was written few years ago and may no longer be relevant as software engineering has changed a lot in the last few years. This is what may be more relevant now: Future of Software Engineering - Gaurav ChandakThis article will help you create a roadmap on how to get started with competitive programming and improve with time to perform well in competitive programming contests.
If you don't know much about competitive programming, you may want to read the 'Beginner's Guide to Competitive Programming' first.
In this article we will learn about:
- The steps required to get started with competitive programming.
- The topics that you need to learn to get good at competitive programming.
- The best resources for competitive programming.
- Common mistakes to avoid in competitive programming as a beginner.
If you are here for interview preparation, you might want to check out this article first: Is competitive programming necessary to crack interviews at product-based companies?.
How do I get started competitive programming?
You can get started with competitive programming (CP) by following the below roadmap:
Learn a programming language
Start by learning a programming language. Most competitive programmers participate using C/C++. Java is the second most popular language for competitive programming. I would suggest you pick either C++ or Java. Avoid languages like Python or JavaScript as most of the problems are not tested for those languages and many contests don't even allow those languages.
You can learn C and C++ in a hands-on way by enrolling in our 'Learn to Code in C/C++' program.
Practice coding on an online platform
Writing code on online judges is very different from how coding is taught in the classroom. Additionally, there are certain errors that you would mostly not encounter while coding offline as you would generally not test in a constrained manner while coding offline. Warm-up by solving some practice questions which require you to solve logical problems without any prerequisite.
The first 2 steps should take around a month.
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 competitive programming. It might help you solve more questions while you participate in contests. If you want to start with contests as soon as possible, you may skip this step and learn data structures and algorithms along the way.
Make sure to at least learn DSA Foundations like how to compute the time and space complexity, recursion, and divide and conquer.
Solve practice problems on CodeChef
Start solving beginner and easy problems on CodeChef. The initial problems are ad-hoc problems and don't have any prerequisites. You can solve them based on basic maths or simple logic. Solve the first 30 problems from beginner and first 30 problems from easy. Initially, it might take some time to solve problems. It is totally fine to stay stuck and ultimately solve after putting in the effort. That will make you a better problem-solver. You may even encounter different types of issues. Google is your friend.
This should take around 15 days at an average of 4 problems per day.
Start participating in CodeChef Long Challenges
At this stage, you should be pretty comfortable with online coding. You might not be able to solve many problems, but you will still know the common issues and know how to test and debug. In a contest, always start with the easiest problems.
CodeChef Long Challenge is a great way to learn as you will get 10 days to solve problems. It is fine even if you can solve only a single problem. The idea is to solve as many problems as possible with time.
After a contest, go through the editorials of the next 3 problems and try to understand how to solve them. After going through the editorial, try to solve those problems in the practice section. If that problem requires a concept that you are not aware of (most likely a data structure or algorithm), learn about it and solve a few questions that require that concept.
Continue doing this as long as possible to keep learning.
Start participating in short contests across websites
Shorter contests are the real thing in Competitive Programming. You can become a good competitive programmer only by participating in short contests (2 to 2.5 hours).
After a couple of long contests, you should focus on participating in as many contests as possible across platforms like CodeChef, Codeforces, AtCoder, etc. It is ok even if you are unable to solve a single problem when you start. Focus on improving with every contest by going through the editorial and solving the next 2-3 unsolved problems. It is a continuous journey of learning. As you start solving more and more problems, the concepts would get more difficult.
Continue doing this as long as possible to keep getting better.
What are the different topics to learn in competitive programming?
The most common topics that you will have to learn while doing competitive programming are:
- DSA Foundations
- Time & Space Complexity Analysis
- Recursion
- Divide & Conquer
- Basic DSA
- Arrays
- Linked List
- Stack
- Queue
- Basic Algorithms
- Searching and Sorting
- Hashing
- 2 pointers
- Backtracking
- Maths for Programming
- Fundamentals (Binary Exponentiation, Euclidean Algorithm, etc)
- Algorithms related to prime numbers (Sieve of Eratosthenes, etc)
- Number Theory (Euler's totient, etc)
- Modular Arithmetic (Modulo inverse, Chinese remainder theorem, etc)
- Number Systems (Balanced Ternary, Gray code, etc)
- Linear Algebra
- Geometry
- Combinatorics
- Numerical Methods
- Misc (Fast Fourier transform, Polynomials, etc)
- Intermediate Algorithms
- String Manipulation
- Bit Manipulation
- Greedy
- Intermediate Data Structures
- Trees
- Set
- Map
- Heap
- Slightly Advanced Algorithms
- Dynamic Programming (DP)
- Graph DSA
- Advanced DSA
- Game Theory
- Advanced String Algorithms, Tries
- Segment Trees, Fenwick Trees
- Suffix Tree, Suffix Array
- Heavy Light Decomposition
- Disjoint Set, Graph Coloring, Network Flow
- Sqrt Decomposition
There are more such concepts that you may have to learn. You can read this in more detail at cp-algorithms. You do not need to do all of it before competing. You can learn these with time.
What are the best resources to become good at competitive programming?
Competitive Programming is all about practice and improving with every contest. There is no substitute for that. Initially, you will learn most of the things while you are stuck in a problem and Google for stuff. With time you might have to build an understanding of different concepts.
These are the best resources which you may go through as you get time apart from the contests:
- cp-algorithms - English transalation of E-Maxx Algorithms
- Competitive Programmer's Handbook by Antti Laaksonen
- cpbook by Steven Hamil and Felix Hamil
- Topcoder Competitive Programming Tutorials
Good problem sets for practice (Intermediate/Advanced):
Common mistakes to avoid in competitive programming as a beginner
These are the common mistakes to avoid in competitive programming as a beginner:
- Focusing too much on the programming language
- All practicing, No learning
- All learning, No practicing
- Only participating in contests
- Not participating in contests
- Solving random questions
- Giving up
You can read a more comprehensive article on this at Common Mistakes to avoid in Competitive Programming for Beginners.
----
I hope that this roadmap will help you during your competitive programming journey.
Please reach out to me on WhatsApp at





