Competitive Programming Roadmap
A comprehensive guide from basics to advanced topics. Master problem-solving skills and crack interviews at top tech companies.
Why Competitive Programming?
DSA is just a small portion of questions/topics. CP trains your mind how to think when a problem arises - exactly what big IT companies look for. The ability to find effective and efficient solutions to new problems quickly is invaluable.
Popular CP Platforms
The most preferred language for CP/DSA
If you have ESC112 experience, transition smoothly. Otherwise, watch tutorials and practice beginner problems.
Practice Problems
Understanding algorithm efficiency
Learn to analyze time complexity to write efficient solutions within constraints.
Resources
Practice Problems
C++ Standard Template Library essentials
Master vectors, sets, maps, stacks, queues - essential data structures for CP.
Fundamental sorting algorithms
Understand sorting algorithms and when to use custom comparators.
Resources
Practice Problems
Divide and conquer efficiently
Essential technique for searching in sorted arrays and answer-based binary search.
Manipulate bits efficiently
XOR, AND, OR operations and their applications in problem solving.
Practice Problems
GCD, Modular arithmetic, Binary exponentiation
Foundation for many advanced algorithms. Master GCD, LCM, and modular operations.
Practice Problems
Solve problems by breaking them down
Essential for understanding DP and backtracking algorithms.
Practice Problems
Brute force and backtracking
Generate all possibilities when constraints are small enough.
Resources
Practice Problems
Sieve of Eratosthenes and prime factorization
Efficiently find all primes up to N. Essential for number theory problems.
Practice Problems
Optimize array traversal
Reduce O(n²) to O(n) for many array problems.
Resources
Efficient range sum and 2D prefix sums
Precompute prefix sums for O(1) range queries. Learn Kadane's algorithm.
Resources
Break problems into subproblems
Merge sort, quick sort, and counting inversions.
Resources
Practice Problems
Make locally optimal choices
Activity selection, interval scheduling, and optimization problems.
Resources
Store and reuse subproblem solutions
Master recursion with memoization and bottom-up DP. Practice extensively!
Advanced DP techniques
DP on 2D grids and using bitmasks to represent states.
Resources
Counting and probability in CP
Permutations, combinations, derangements, and expected values.
Practice Problems
Solve recurrences efficiently
Compute nth term of linear recurrences in O(k³ log n).
Resources
Practice Problems
Range queries and updates
Point updates and range queries in O(log n). Essential data structure!
Graph traversal fundamentals
BFS for shortest path, DFS for connectivity and cycle detection.
DAG ordering and cycle detection
Order nodes in DAG, detect cycles in directed/undirected graphs.
Practice Problems
Union-Find data structure
Efficiently manage disjoint sets with path compression and union by rank.
Kruskal's and Prim's algorithms
Find minimum cost to connect all nodes in a weighted graph.
Practice Problems
Dijkstra, Bellman-Ford, Floyd-Warshall
Single-source and all-pairs shortest paths with different constraints.
KMP, Z-algorithm, Aho-Corasick
Pattern matching and string processing algorithms.
Practice Problems
Kosaraju's and Tarjan's algorithms
Find SCCs and build condensation graphs for directed graph problems.
O(1) range queries and tree ancestors
Precompute for O(1) idempotent range queries. Binary lifting for LCA.
Practice Problems
Tree diameter, DP on trees, Euler tour
Tree traversals, rerooting technique, and tree DP patterns.
Boolean satisfiability problems
Solve boolean formulas with at most 2 literals per clause using SCCs.
Resources
Practice Problems
Dynamic programming on directed acyclic graphs
Combine topological sort with DP for path counting and optimization.
Resources
Give Contests Regularly!
Throughout your learning journey, give as many contests as you can on Codeforces, AtCoder, CodeChef, etc. There is no better way of learning how to think than giving contests. After each contest, try to solve at least one more question you couldn't solve (UP-SOLVING).
Your Target
Reach Expert on Codeforces & 1900+ rating on LeetCode. This boosts your resume significantly. Once at this level, cracking a job at a high-paying MNC becomes much easier.
Pro tip: Go through the CSES Problem Set to become really good at CP.
No More Excuses
You have all the required resources and the complete roadmap. JUST START PRACTICING.