Competitive Programming
Courses
A structured climb toward top-ranked competitive programming. The site's algorithm pages are the Wikipedia-style reference; this course is the ordered path through them — each unit names what to learn, links the pages that teach it, and adds the contest-specific technique and practice the reference pages don't cover. Built to take a competent programmer to a strong CodeChef / Codeforces rating.
The contest loop
plannedBefore any algorithm: the complexity budget, fast I/O, and the language toolkit that decides a third of your rating.
- lessonThe 10⁸ rule: read constraints, pick the complexity that fitsplanned
- lessonFast I/O and the contest template (C++ & Python)planned
- lessonThe standard library is half the battle: what to reach forplanned
Core data structures
● you are here0/1The structures every problem is secretly about: hash tables, heaps, ordered sets, and disjoint-set union.
- readingReading — Union-Find (disjoint set union)20m
- lessonHash maps & sets: membership, counting, and the anti-hash testplanned
- lessonHeaps & priority queues: the top-k workhorseplanned
- lessonOrdered sets & policy trees: when you need rank, not just presenceplanned
- lessonDSU with rollback and small-to-large: beyond the textbookplanned
Sorting, searching, two pointers
0/3Binary search is not about sorted arrays — it is about monotone predicates. Two pointers and sliding windows turn O(n²) scans into O(n).
- readingReading — Binary Search15m
- lessonBinary search on the answer: the single highest-yield trickplanned
- lessonTwo pointers & sliding window: the O(n) sweepplanned
- readingPractice — Three Sum (two-pointer on a sorted array)20m
- readingPractice — Longest substring without repeating (window)20m
Graphs I — traversal & shortest paths
0/4BFS, DFS, and Dijkstra cover most contest graph problems. The skill is modeling: seeing the grid, the state machine, the implicit graph.
- readingReading — Breadth-First Search15m
- readingReading — Depth-First Search15m
- readingReading — Dijkstra's algorithm20m
- readingReading — Topological Sort15m
- lesson0-1 BFS and multi-source BFS: Dijkstra’s cheaper cousinsplanned
- lessonModeling: when the graph is hiding in the problemplanned
Dynamic programming
0/7The single biggest rating divider. State design first, transitions second — then the classic shapes: knapsack, LIS, edit distance, and DP on structure.
- readingReading — Knapsack20m
- readingReading — Longest Increasing Subsequence20m
- readingReading — Edit Distance20m
- lessonDesigning the state: the part nobody teaches8m·
- lessonBitmask DP: subsets as integers7m·
- lessonDP on trees: rerooting and subtree aggregates7m·
- lessonDigit DP: counting numbers with a property7m·
Greedy & exchange arguments
0/1Greedy is easy to code and hard to trust. The skill is the proof — the exchange argument that tells you it is safe, and the counterexample when it is not.
- readingReading — Coin Change (where greedy fails, DP saves it)20m
- lessonExchange arguments: proving a greedy choice is safeplanned
- lessonInterval scheduling, Huffman, and the greedy canonplanned
Number theory & combinatorics
0/3GCD, sieves, modular arithmetic, and counting under a prime modulus — the math half of competitive programming.
- readingReading — The Euclidean Algorithm15m
- readingReading — Sieve of Eratosthenes15m
- readingReading — Modular Exponentiation15m
- lessonModular inverse and nCr mod p: counting under 10⁹+7planned
- lessonInclusion-exclusion: counting by overcounting on purposeplanned
- lessonCRT and linear Diophantine equationsplanned
Strings
0/3Pattern matching in linear time, then hashing and the Z-function — the tools that make string problems tractable.
- readingReading — KMP (Knuth-Morris-Pratt)20m
- readingReading — Rabin-Karp (rolling hash)20m
- readingReading — Trie15m
- lessonThe Z-function and prefix-function tricksplanned
- lessonString hashing: comparison in O(1), with the collision mathplanned
- lessonSuffix arrays in outline: when hashing is not enoughplanned
Range queries
0/5Answer "what is the sum/min over [l, r]?" faster than scanning — the family that separates blue from purple: prefix sums, sparse tables, Fenwick, segment trees.
Graphs II — advanced structure
0/4Minimum spanning trees, all-pairs paths, connectivity decomposition, and ancestor queries — the heavier graph machinery.
- readingReading — Kruskal's MST20m
- readingReading — Prim's MST15m
- readingReading — Floyd-Warshall15m
- readingReading — Bellman-Ford (negative edges)20m
- lessonStrongly connected components: Tarjan & Kosarajuplanned
- lessonBridges & articulation pointsplanned
- lessonLCA by binary lifting: ancestor queries in O(log n)planned
- lessonMax flow / min cut: the modeling power and the intro algorithmplanned
Advanced topics
plannedThe purple-and-up toolbox: linear recurrences by matrix power, convolution by FFT, game theory, and a first taste of geometry.
- lessonMatrix exponentiation: nth Fibonacci in O(log n)planned
- lessonFFT/NTT in outline: multiply polynomials in n log nplanned
- lessonGame theory: Sprague-Grundy and the nim-valueplanned
- lessonComputational geometry primer: orientation, hull, sweepplanned
Contest craft
0/4The meta-skill: reading a set, estimating difficulty, stress-testing a suspect solution, allocating time — and the deliberate path up the rating ladder.