Big-O Notation
Count how much work code performs, then describe how that work grows with the input.
Concept lesson · No dedicated problem set
Learn the concept, understand its prerequisites, then build confidence through practice.
Prerequisites guide your preparation; they do not block access to a lesson.
Count how much work code performs, then describe how that work grows with the input.
Concept lesson · No dedicated problem set
Learn how indexed storage works, what each array operation costs, and how one safe pass grows into in-place and matrix algorithms.
Treat text as an indexed sequence first, then add immutable output, word boundaries, symmetry, runs, direct search, and grammar one idea at a time.
Learn bubble, selection, and insertion sort by watching which part of the array becomes permanently ordered after each pass.
A function that trusts a smaller call to itself to solve a smaller version of the same problem — with a base case as the trapdoor that stops the falling.
Sorting is rarely the answer by itself — it's the setup that turns a hard search into a single, boring pass.
Binary search isn't about sorted arrays — it's about any monotonic true/false predicate, and the array is just the most common place one shows up.
No indexing, no contiguous memory — just nodes pointing to the next one, which is exactly what makes O(1) insertion possible.
A stack remembers what to undo; a queue remembers what to do next, in the order it arrived.
Progress from remembering whether a key exists to storing counts, complements, canonical signatures, and one-to-one mappings.
Two indices moving through a structure with a clear rule, so every step throws away work you never need to redo.
A window that only ever grows on the right and shrinks on the left — each edge crosses every position at most once, so the whole scan is O(n).
Once you know the running total up to every point, the sum of ANY range is just one subtraction away — no matter how long the range is.
Trees represent hierarchical relationships. Binary search trees add an ordering rule that makes search, insertion, and deletion follow one root-to-leaf path.
A heap keeps only one promise — instant access to the current best — and gives up full ordering to make that promise cheap to maintain.
Let each character choose the next branch, so string queries depend on the key rather than the number of stored keys.
Concept lesson · No dedicated problem set
Keep only unresolved candidates in useful order, so many nearest-greater or nearest-smaller queries finish in one pass.
Most 'graph problems' aren't handed to you as a graph at all — a grid, a word list, or a set of game states IS a graph the moment you decide what a 'node' and an 'edge' mean.
Maintain connected groups while new links arrive, without searching the whole graph after every update.
Turn directed prerequisites into a valid order, or expose the cycle that makes every order impossible.
Sort by start time, then a single left-to-right sweep answers almost every question about overlaps.
Concept lesson · No dedicated problem set
A greedy algorithm never looks back — it commits to the locally best choice at every step, and the whole challenge is proving that never backtracking still finds the global optimum.
Backtracking is just depth-first search over a tree of choices you build as you go, undoing each choice once you've explored where it leads.
A repeatable way to turn a slow recursive search into a fast one by identifying and reusing overlapping subproblems.
Read integers as binary patterns, change selected positions with masks, and reuse a small set of identities in interview problems.
Concept lesson · No dedicated problem set
Additional exercises, including Miscellaneous, remain available in the complete problem browser.