Goal-based paths · 12 steps

Competitive programming

Read constraints, pick the algorithm that fits them, and know the techniques contests rely on: bits, math, prefix sums, binary search on answer, graphs and DP.

Who it is for
Programmers starting contests who are comfortable with a language and basic data structures.
By the end
You can map input limits to a target complexity and reach for the matching technique quickly and correctly.
  1. Step 1: From constraints to complexity

    Contest limits tell you the intended complexity; recognising √n, n log n and harmonic loops is the first skill.

  2. Step 2: Bits and number theory

    Overflow, modular arithmetic, gcd and bit tricks appear in a large share of easy and medium tasks.

  3. Step 4: Prefix sums and difference arrays

    Range queries and range updates on static arrays are prefix sums and difference arrays.

  4. Step 5: Two pointers and windows

    Linear-time scans over sorted data and contiguous ranges replace many quadratic ideas.

  5. Step 6: Monotonic stacks and deques

    Nearest greater element and window maximum in O(n) are standard contest building blocks.

  6. Step 7: Heaps

    Needed for Dijkstra, greedy scheduling and k-way merges in the following steps.

  7. Step 9: Greedy

    Greedy solutions are short but need a proof; exchange arguments and counterexamples are the contest skill.

  8. Step 11: Dynamic programming

    The largest topic in contests; start with 1D states and space optimisation.

  9. Step 12: Combining techniques

    Harder tasks combine two or three of the above; the final module practises that.