Drill

Problems › Techniques

The roadmap

Every problem here trains a named topic — a hash map, a sliding window, a binary search. Some are concepts, the material itself; the rest are patterns, the moves you make with it, which is the part an interview is really testing. The five stages below run in teaching order: each leans on the one above it, so working down the page takes you from writing a loop to the patterns interviews ask about.

Open the editor →

1 Foundations

Arithmetic you can trust, and the two containers everything else is built on.

2 Counting and shaping

Turn a pile of records into an answer: tally it, order it, read it.

3 Scanning a sequence

One pass instead of two loops — the move that turns O(n²) into O(n).

4 Structures and search

Pick the shape that fits the problem and the search gets easy.

5 Ways of thinking

Less about a data structure than about the argument you make for an answer.