🏁 Competitive programming for kids
Sorting and searching, greedy algorithms, dynamic programming, graphs, shortest paths, spanning trees, flows, number theory, game theory and the fast Fourier transform — the contest toolkit, at a size a child can hold.
- 25 units
- 101 lessons
- 700 exercises
- Units 1–2 free
- Ages 8–15
How this track is kept honest
Every algorithm here exists to avoid an obvious slow one, so every answer is re-checked by brute force: every subarray, every subset, every permutation, every spanning tree, every ordering of a game. Nothing imports a library that does the lesson for you — heapq and friends arrive only once the thing they replace has been built by hand.
Best after the Python track, and the natural next step from it.
How it starts
You send in a program. A machine runs it on secret data and gives it about one second. Correct but slow scores exactly the same as wrong. So every problem here has two answers: the one that works, and the one that works in time.
The full Contest syllabus
25 units and 101 lessons, in the order they are played. Each unit has a page of its own with every explanation in it, the code samples and what they print, and a few questions to try.
Unit 1: Beat the Clock
Right is not enough — it has to be fast
- One Second, That Is All
- Naming the Shape
- The Limits Tell You the Plan
- The Same Answer, Three Speeds
Unit 2: Try Everything
When brute force is the right answer
- Every Subset
- Every Order
- Stop Early
- Eight Queens
Unit 3: Bits
A whole set inside one number
- Numbers Are Rows of Switches
- And, Or, Xor, Shift
- A Set Inside One Number
- The Number That Came Alone
Unit 4: Sort, Sweep, Grab
What sorting buys you
- Sort First, Think Second
- Two Pointers
- Grab the Best Thing Now
- Fitting In the Most Events
Unit 5: Cut It In Half
Binary search, and searching the answer itself
- Guess the Number
- The First One That Fits
- Search the Answer Itself
- Meet in the Middle
Unit 6: Questions About Ranges
Answer a million questions about a million numbers
- Prefix Sums
- When the Numbers Change
- The Smallest in a Range
- Choosing the Right Box
Unit 7: Remember the Answer
Dynamic programming, the way contests use it
- State, Move, Start
- Counting the Ways
- The Longest Climb
- The Knapsack
- The Salesman Comes Back
Unit 8: Maps and Mazes
Graphs, and the two ways to walk one
- Getting the Map Into the Computer
- Going Deep
- Going Wide
- Out of the Maze
Unit 9: Shortest Roads
Three algorithms, three prices
- Keep Relaxing
- Dijkstra
- Every Pair at Once
- Which One, and When
Unit 10: One Way Only
Graphs with no way back
- Putting Jobs in Order
- Counting Along the Order
- One Exit Each
- The Critical Path
Unit 11: Going in Circles
Finding the loop, and where it starts
- Three Colours
- Loops Without Arrows
- Which Nodes Are In It
- Tortoise and Hare
Unit 12: Cheapest Network
Joining everything up for the least money
- Wiring Up the Village
- Are We in the Same Group?
- Kruskal
- Prim, and Going the Other Way
Unit 13: Trees
One route between any two places
- Hanging It Up
- Counting on the Way Back Up
- The Longest Journey
- The Nearest Shared Ancestor
Unit 14: Numbers and Primes
Arithmetic that survives a modulus
- Sieving for Primes
- Taking a Number Apart
- Working Under a Modulus
- Dividing Under a Modulus
Unit 15: Counting Without Listing
Answers with more digits than the universe has atoms
- Choose
- Pascal's Triangle
- Add Some, Take Some Back
- Catalan Numbers
Unit 16: Grids of Numbers
Doing a thousand million steps at once
- Multiplying Matrices
- Fibonacci in Thirty Steps
- Counting Walks
- Building Your Own Recurrence
Unit 17: Chance
Counting what has not happened yet
- Count the Good Ones
- What It Is Worth on Average
- Where the Chance Flows
- How Long Until It Happens
Unit 18: Winning Games
Both players play perfectly
- Winning and Losing Places
- Nim
- Grundy Numbers
- Many Heaps, Strange Rules
Unit 19: Multiplying Fast
The Fourier transform, and what it is for
- What Multiplying Really Is
- Points Instead of Coefficients
- The Points That Fold
- The Fast Fourier Transform
Unit 20: Round Trips
Which places can reach each other
- There and Back Again
- Kosaraju
- Squash It Into a DAG
- Joining the Map Up
Unit 21: Every Edge, Every Node
One easy problem and one impossible one
- The Bridges of Königsberg
- Walking It
- One-Way Tours
- Every Node Once
Unit 22: Weak Points
The one road, and the one town, that holds it together
- The Search Tree
- Bridges
- Articulation Points
- How Fragile Is the Network?
Unit 23: Flows
How much can get through at once
- Pipes and Undoing
- Edmonds–Karp
- Cuts and Matchings
- The Cheapest Way Through
Unit 24: Shapes and Sweeps
One sign answers most of geometry
- Left or Right?
- Do These Two Cross?
- The Elastic Band
- The Sweep Line
Unit 25: Words and Patterns
Finding a needle in a very long haystack
- A String as a Number
- The Prefix Function
- A Tree of Letters
- Three Ways to Find It
Other things to learn
- 🐍 Python for kids
The friendliest first language. Start here!
- ✨ JavaScript for kids
The language of websites. Try it after Python.
- ⚙️ C programming for kids
How computers really work. Read, predict and reason about real C.
- 🚀 C++ for kids
C with the sharp edges filed off. Powers most games.
- 🔌 Digital logic for kids
Start with one tiny switch. Finish with a working computer.
- 🌱 Git and version control for kids
Save your work forever, and share it.
- 🐧 Linux and the command line for kids
Drive a whole computer by typing.
- 🔢 Problem-solving maths for kids
Powers, shapes, chances and proof — the way problem solvers see them.
- 🤖 AI and machine learning for kids
Teach a computer to learn — with nothing but adding and multiplying.
- 🤖 Robotics coding for kids
Write code that drives a machine around a room.