Code-driven animation · word-synced narration
Algorithms are transitions. Watch the transitions.
Static diagrams show a state — the interesting part is what happens between states. Every animation here is TypeScript, rendered at 4K.
- Data Structures & AlgorithmsArrays, trees, graphs, sorting, strings.35 problems
- System DesignLoad balancing, sharding, consensus, caching.18 topics
- Concurrency & ParallelismLocks, actors, CSP, memory models.18 topics
- Design PatternsGoF patterns shown as running systems.23 patterns
94/94
Data Structures & Algorithms
35 problems- DSA 7 minArrays and Strings
Why contiguity is the whole advantage, and what it costs when you insert in the middle.
- DSA 8 minBacktracking
Trying every possibility without trying every possibility — how one rejection prunes a whole branch.
- DSA 8 minBinary Search
Why halving beats scanning, and the one sentence that has to stay true for the loop to be correct.
- DSA 7 minBit Manipulation
What integers actually look like in memory, and the handful of tricks worth memorising.
- DSA 5 min easyCan Place Flowers
Plant as early as possible — and the function that quietly rewrites its caller's garden.
- DSA 6 min easyConcatenation of Array
A three-line problem that is really about Go slices — capacity, copying, and who owns the array.
- DSA 6 min easyContains Duplicate
The first problem where a set beats a nested loop — and what Go uses for a set.
- DSA 9 minDynamic Programming
Recursion that stops repeating itself — and how to find the state that makes it work.
- DSA 9 minGraphs and Shortest Paths
Four algorithms, and the one property of your graph that decides which of them is allowed.
- DSA 8 minGreedy
Take the best option in front of you — and the proof you owe before you are allowed to.
- DSA 6 min mediumGroup Anagrams
A canonical key turns grouping into one map insert — and Go lets the key be an array.
- DSA 8 minHash Maps
Why average O(1) is a statement about spread, and what happens when the spread fails.
- DSA 7 minHeaps and Priority Queues
A tree hidden inside an array, and why knowing less is cheaper than knowing everything.
- DSA 6 min easyIs Subsequence
Two pointers that only move forward — and the byte-versus-rune slip that crashes it.
- DSA 6 min easyIsomorphic Strings
A consistent one-to-one substitution — and why checking one direction is not enough.
- DSA 4 min easyLength of Last Word
Two lines with the standard library, or one backwards scan — and why the trailing space is the whole problem.
- DSA 7 minLinked Lists
Pointer surgery without losing the list, and the dummy node that removes every edge case.
- DSA 5 min easyLongest Common Prefix
Compare down the columns, not along the words — and stop at the first disagreement.
- DSA 6 min easyMajority Element
Boyer-Moore voting — constant space, and only correct because the problem promises something.
- DSA 7 minMatrix Traversal
Grids are graphs with invisible edges — and the direction array that keeps the code honest.
- DSA 8 minMerge Sort
Divide until trivial, then merge — and why the recursion tree gives you the running time for free.
- DSA 7 minMerging Intervals
Sort by start, sweep once — and the off-by-one that decides whether touching ranges count.
- DSA 8 min easyNext Greater Element
How a monotonic stack turns a quadratic scan into one pass, and why the stack can never stop being decreasing.
- DSA 5 min easyPascal's Triangle
Each row from the one above it — the smallest dynamic programming table there is.
- DSA 5 min easyRemove Element
Removing in place without shifting — one boundary, one pass, and what the return value really is.
- DSA 5 min easyReplace Elements with Greatest Element on Right Side
Walk backwards and the quadratic scan disappears — the smallest suffix-aggregate problem.
- DSA 7 minSliding Window
Why the window never moves backwards, and how that turns a quadratic scan linear.
- DSA 6 minStacks and Queues
Two rules for "what next", and why the choice changes which order you explore.
- DSA 7 minTwo Pointers
One pass instead of two loops, and the ordering property that makes discarding safe.
- DSA 7 minUnion-Find
Keeping track of who is connected to whom, and the two one-line tricks that make it nearly free.
- DSA 4 min easyUnique Email Addresses
Normalise, then count the set — and the one part of the address you must not touch.
- DSA 7 min easyValid Anagram
One tally instead of two — and the Unicode bug hiding in the obvious Go solution.
System Design
18 topics- System Design 6 minBackpressure
Telling a fast producer to slow down — and what happens to latency when you do not.
- System Design 6 minBloom Filters
"Definitely not there" for a few bits per item — and why the other answer is only a maybe.
- System Design 7 minCaching Strategies
Where the copy lives, who writes it, and the two hard problems underneath.
- System Design 6 minCAP and PACELC
The choice you only make during a partition — and the one you make the rest of the time.
- System Design 6 minCDNs and Edge Caching
The speed of light is the constraint — and the only fix is to already be there.
- System Design 8 minConsensus and Raft
Getting a majority to agree on one value — and the two rules that make it safe.
- System Design 6 minConsistent Hashing
Why adding a shard should move 1/n of the keys and not all of them.
- System Design 7 minDatabase Indexing
Why a B-tree and not a hash map — and the column order that decides whether your index is used at all.
- System Design 7 minEvent Sourcing
Store what happened, derive the current state — and the migration problem you inherit.
- System Design 6 minIdempotency
Making retries safe — because in a distributed system the client cannot tell failure from a lost reply.
- System Design 6 minLeader Election
Picking one node to be in charge — and the fencing token that makes it actually safe.
- System Design 6 minLoad Balancing
Spreading requests across servers — and why counting them is not the same as spreading work.
- System Design 7 minMessage Queues
Decoupling producers from consumers — and the delivery guarantee you actually get.
- System Design 7 minObservability
Asking questions you did not plan for — and why averaging latency hides the outage.
- System Design 6 minRate Limiting
Four algorithms, and the boundary bug that makes the simplest one allow double.
- System Design 7 minReplication
Copies for durability and read capacity — and the lag that makes users see their own writes disappear.
- System Design 7 minSharding
Splitting data across machines — and the key choice you cannot easily take back.
- System Design 6 minWrite-Ahead Logs
Write the intention before the change — and get durability, replication and time travel from one idea.
Concurrency & Parallelism
18 topics- Concurrency 6 minActors
One owner per piece of state, reachable only by message — and what that buys you across a network.
- Concurrency 6 minAmdahl's Law
The part you cannot parallelise sets a ceiling — and it is lower than you think.
- Concurrency 6 minAtomics
Indivisible operations in hardware — and the loop that turns one into any update you like.
- Concurrency 5 minCondition Variables
Waiting for a state, not a lock — and why the check has to be a while loop.
- Concurrency 6 minCSP and Channels
Don't communicate by sharing memory; share memory by communicating.
- Concurrency 6 minDeadlock
Four conditions, all required — so breaking any one of them is a complete fix.
- Concurrency 7 minEvent Loops
One thread, no blocking — and the queue ordering that decides what actually runs next.
- Concurrency 6 minHappens-Before
The relation that decides what one thread is allowed to see of another.
- Concurrency 6 minLock-Free Structures
Progress guarantees, and the memory-reclamation problem that makes them hard.
- Concurrency 6 minMemory Models
What the hardware and the compiler are allowed to reorder — and why x86 lets bad code pass.
- Concurrency 7 minMutexes and Locks
One holder at a time — and why the lost update happens on the line you thought was atomic.
- Concurrency 6 minRead-Copy-Update
Readers pay nothing at all — and the writer waits for them to leave before freeing anything.
- Concurrency 5 minSemaphores
A counter with a queue attached — and why it is not a mutex with extra steps.
- Concurrency 6 minStructured Concurrency
Tasks that cannot outlive the block that started them — goto, but for threads.
- Concurrency 6 minThread Pools
Reuse the workers, queue the work — and the two questions that decide the size.
- Concurrency 5 minThreads and Processes
What is shared decides everything else — cost, safety, and how a crash spreads.
- Concurrency 6 minWork Stealing
Idle workers take from the busy — and the end of the deque they take from is the whole trick.
Design Patterns
23 patterns- Patterns 5 minAbstract Factory
Whole families that must match — and the cost of adding one more kind of thing.
- Patterns 6 minAdapter
Making an incompatible interface fit — and the one file that should know the vendor's vocabulary.
- Patterns 6 minBuilder
Assembling a complicated object step by step — and the validation you can only do at the end.
- Patterns 5 minChain of Responsibility
Pass the request along until somebody claims it — and the case nobody handles.
- Patterns 6 minComposite
Treating one thing and many things identically — and the method that does not belong on a leaf.
- Patterns 6 minDecorator
Adding behaviour by wrapping rather than subclassing — and why the order of the wrappers is a real decision.
- Patterns 6 minFactory Method
Letting a subclass decide what to construct — and why a plain function is usually enough.
- Patterns 5 minFlyweight
Sharing the heavy part between many objects — and the split that makes it possible.
- Patterns 5 minInterpreter
A grammar as a class hierarchy — and why you should almost always use a parser generator instead.
- Patterns 6 minIterator
Walking a collection without knowing its shape — and why laziness is the part that matters.
- Patterns 5 minMemento
A snapshot that only its owner can read — and why undo usually wants commands instead.
- Patterns 6 minObserver
One-to-many notification without the sender knowing who is listening — and the leak it invites.
- Patterns 5 minPrototype
Copying an existing object instead of constructing one — and the depth of the copy.
- Patterns 6 minProxy
A stand-in with the same interface — and the fact that callers cannot tell is both the feature and the hazard.
- Patterns 6 minSingleton
One instance, globally reachable — and why the second half of that is the problem.
- Patterns 6 minState
Behaviour that follows the mode — and how the illegal transitions stop being reachable.
- Patterns 6 minStrategy
The algorithm as a parameter — and why in most languages it is now just a function.
- Patterns 5 minTemplate Method
The skeleton fixed, the steps varied — inheritance's one genuinely good use, and its limits.
- Patterns 6 minVisitor
Adding an operation without editing the classes — and the price it charges for that.