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.
Your learning map
Sign in to keep your progress on the map.
First steps
steps 1 to 6How a solution runs here
Beginner8 min readWhat 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
Values, types and the numbers that overflow
Beginner10 min readWhole 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
Decisions and loops
Beginner10 min readif 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
Functions, helpers and what happens to arguments
Beginner9 min readSplitting 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
Arrays and lists in everyday code
Beginner10 min readFixed 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
Maps and sets in everyday code
Beginner9 min readFinding 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 7Arrays and hashing
steps 8 to 11Where your data actually lives
Beginner8 min readMemory 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
Arrays: what is cheap and what is not
Beginner9 min readFour operations, four different costs. Knowing which is which turns most array problems from guesswork into arithmetic.
0 of 10 practice problems solved
Hash tables: how a lookup can skip the search
Beginner11 min readTurn 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
Trading memory for time with a hash map
Beginner12 min readWhy 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 13Recursion
step 15Sorting
step 16Searching
step 17Linked lists
step 19Stacks and queues
steps 21 to 22Stacks and queues: choosing which end to work from
Beginner9 min readTwo structures that differ by one decision: when you take something out, is it the newest or the oldest?
0 of 11 practice problems solved
Stacks: when the most recent thing is the thing that matters
Beginner10 min readNesting 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 25Trees: one thing above, several below
Beginner10 min readA 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
Traversals: four orders, and which question each answers
Beginner12 min readPreorder, 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