</>CodexBash
Learn path · free to read

One idea at a time, then the problems that use it

A path from counting digits to graphs, numbered so you always know where you are. Each lesson explains a single technique, shows it running step by step, and hands you the problems where it is the right answer. C, C++, Java and Python are only ways of talking to a computer. The thinking is what carries across.

36 lessons, in order. Start at one, or start where you are stuck.

First steps

steps 1 to 6
  1. How a solution runs here

    Beginner8 min read

    What the judge does with your code: you write one function, it reads the input, calls you and checks what you return. The same problem in C, C++, Java and Python.

    0 of 3 practice problems solved

  2. Values, types and the numbers that overflow

    Beginner10 min read

    Whole numbers and how big they get, dividing without fractions, remainders, doubles that are almost right, and text in four languages.

    0 of 3 practice problems solved

  3. Decisions and loops

    Beginner10 min read

    if and else, for and while, stopping early, the off by one error, and why a loop inside a loop is too slow for large inputs.

    0 of 3 practice problems solved

  4. Functions, helpers and what happens to arguments

    Beginner9 min read

    Splitting a solution into small named helpers, which arguments a function can change for its caller, and returning more than one value.

    0 of 3 practice problems solved

  5. Arrays and lists in everyday code

    Beginner10 min read

    Fixed and growable arrays, returning one to the judge, sorting with the built-in sort, and building grids without the classic Python trap.

    0 of 3 practice problems solved

  6. Maps and sets in everyday code

    Beginner9 min read

    Finding things by value rather than position: sets, maps and counting in C++, Java and Python, and the array tricks that stand in for them in C.

    0 of 3 practice problems solved

Numbers

step 7
  1. Numbers: the digits inside them

    Beginner9 min read

    Two operations, remainder and division, take any number apart digit by digit. Almost every beginner number problem is that one loop with a different thing done to each digit.

    0 of 4 practice problems solved

Arrays and hashing

steps 8 to 11
  1. Where your data actually lives

    Beginner8 min read

    Memory is one long numbered street. Almost every cost in this course comes from that one fact, so it is worth ten minutes before anything else.

    0 of 4 practice problems solved

  2. Arrays: what is cheap and what is not

    Beginner9 min read

    Four operations, four different costs. Knowing which is which turns most array problems from guesswork into arithmetic.

    0 of 10 practice problems solved

  3. Hash tables: how a lookup can skip the search

    Beginner11 min read

    Turn a key into a number, use that number as an address. The whole trick, plus what happens when two keys collide.

    0 of 4 practice problems solved

  4. Trading memory for time with a hash map

    Beginner12 min read

    Why a second pass beats a nested loop, and how remembering what you have seen turns a quadratic search into a single sweep.

    0 of 12 practice problems solved

Two pointers and windows

step 13
  1. Two pointers: replacing a nested loop with a single pass

    Beginner10 min read

    Two indexes walking one array, never going backwards. Turns a great many quadratic solutions into linear ones.

    0 of 13 practice problems solved

Recursion

step 15
  1. Recursion: trusting the smaller problem

    Beginner12 min read

    A function that calls itself is not magic and not a loop in disguise. It is a machine that takes one step and hands the rest to a copy of itself, with the call stack keeping the paperwork.

    0 of 8 practice problems solved

Sorting

step 16
  1. Sorting: which one, and why you will not write any of them

    Beginner14 min read

    You will call the library sort. The reason to know the algorithms anyway is that their ideas turn up inside problems that are not about sorting at all.

    0 of 5 practice problems solved

Searching

step 17
  1. Binary search, and getting the boundary right

    Beginner14 min read

    Halving the search space is the easy part. The hard part is deciding what to return when the value is not there.

    0 of 7 practice problems solved

Linked lists

step 19
  1. Linked lists: giving up indexing to buy insertion

    Beginner10 min read

    Values that do not sit next to each other, each one holding the address of the next. The exact opposite trade from an array.

    0 of 5 practice problems solved

Stacks and queues

steps 21 to 22
  1. Stacks and queues: choosing which end to work from

    Beginner9 min read

    Two structures that differ by one decision: when you take something out, is it the newest or the oldest?

    0 of 11 practice problems solved

  2. Stacks: when the most recent thing is the thing that matters

    Beginner10 min read

    Nesting is the signal. When the correct partner for what you are looking at is always the most recent unmatched item, you want a stack.

    0 of 3 practice problems solved

Trees

steps 24 to 25
  1. Trees: one thing above, several below

    Beginner10 min read

    A linked list that branches. Everything about trees comes from that, including why searching a balanced one is so fast.

    0 of 8 practice problems solved

  2. Traversals: four orders, and which question each answers

    Beginner12 min read

    Preorder, inorder and postorder differ by one line's position. Level order differs by using a queue instead of recursion, and that single change is the whole idea behind breadth-first search.

    0 of 5 practice problems solved