Skip to main content
Lab
Interactive Sims (21)Pareto Templates (20)Pattern Triage (48)System Scenarios (2)

Lab

Engineering reference for step-by-step algorithm traces, Pareto Python templates (20), pattern triage breakdowns (48), and distributed system design scenarios (2).

Track A: System Design

System Design

Capacity sizing math, layer-by-layer architectural trade-offs, failure scenario evaluations (shard crash, hot key, stampede, 32k LLM burst), and architecture trade-off notes.

Track B: Coding & Algorithms

Coding Patterns

Reusable Python templates (20) with step-by-step traces, pattern triage breakdowns (48) with translation notes, and interactive buggy code traces (3).

Track A: Distributed & ML Systems

Interactive System Design Guides

System Scenarios (2)
Track B: Pareto Algorithm Trace Simulators (20)

Interactive Trace Directory

SIM 01
Sliding Window

Longest substring without repeating characters, explained by the one reason it is O(n) and not O(n²).

sliding window7 min
SIM 02
Binary Search

Stop memorizing off-by-one fixes. Watch the one fact that stays true on every step and the code writes itself.

binary search6 min
SIM 03
Two Pointers

Eliminate an entire row or column of pairs on every step by exploiting sorted order.

two pointers5 min
SIM 04
Hash Map + Prefix Sum

Turn O(n²) subarray sum searches—even with negative numbers—into one O(n) pass.

prefix sum6 min
SIM 05
Monotonic Stack

Resolve 'next warmer / next shorter' queries in O(n) by keeping waiting indices strictly ordered.

monotonic stack6 min
SIM 06
Monotonic Deque

Maintain a double-ended queue of indices in monotonic order to query sliding-window max/min in O(1) amortized time per step.

monotonic deque6 min
SIM 07
Min-Heap Top-K

Why finding the K largest items in a 10M-event stream uses a MIN-heap capped at size K.

heap5 min
SIM 08
Two Heaps

Split a stream into a max-heap lower half and min-heap upper half to maintain the live median in O(log n) per insert and O(1) per query.

two heaps6 min
SIM 09
Multi-Source BFS

Enqueue all starting sources at distance 0 to compute minimum wave time on unweighted graphs and grids.

bfs6 min
SIM 10
Dijkstra's Algorithm

Swap BFS's queue for a min-heap to find minimum-latency routes across non-negative weighted networks.

dijkstra7 min
SIM 11
Topological Sort (Kahn's Algorithm)

Schedule directed prerequisites and detect circular dependencies in O(V + E) using indegree counts.

topological sort6 min
SIM 12
Union-Find (DSU)

Merge clusters and answer 'are these two servers connected?' almost instantaneously as edges stream in.

union-find6 min
SIM 13
Binary Tree Post-Order DFS

Compute tree-wide optima (max path sum, diameter, LCA) by returning a single extendable branch while updating a two-branch split answer.

tree dfs7 min
SIM 14
Sort & Sweep Intervals

Sort by start timestamp once, then resolve every overlap with a single linear sweep.

intervals5 min
SIM 15
Trie (Prefix Tree)

Share common character prefixes as tree edges so lookup speed depends only on query length, never dictionary size.

trie6 min
SIM 16
LRU Cache

Combine a Hash Map and Doubly Linked List to get O(1) get, O(1) put, and O(1) eviction—a bridge between coding and system design.

lru cache7 min
SIM 17
Greedy Running Frontier

Replace O(n²) DP with a single running frontier when local progress never hurts future options.

greedy5 min
SIM 18
Backtracking

Systematically enumerate every valid subset, permutation, or configuration by mutating and unwinding one shared path.

backtracking6 min
SIM 19
Dynamic Programming

Compute globally optimal answers from strictly smaller solved states whenever greedy choices can trap you.

dynamic programming7 min
SIM 20
2D Sequence DP

Compare or align two sequences (LCS, Edit Distance, Regex Matching) on an (n + 1) × (m + 1) table indexed by prefix lengths (i, j).

2d dynamic programming7 min
Backlog

Upcoming System Design Notes

pnpm new:lab "Design X" --kind system
Queued (4)
Design an LLM Inference Serving Engine

Continuous batching, PagedAttention KV-cache memory blocks, prefix caching, and TTFT vs TPOT latency trade-offs at OpenAI scale.

OpenAIAnthropicNVIDIA
Design a Distributed Token-Bucket Rate Limiter

Enforce per-tenant RPM and TPM quotas for an AI API gateway without adding a synchronous bottleneck on every request.

OpenAIStripeCloudflare
Design a Billion-Scale Vector Search Index (HNSW + Sharding)

Approximate nearest neighbors with HNSW graph layers, quantization, scatter-gather sharding, and recall vs latency budgets.

OpenAINetflixMeta
Design a Real-Time Recommendation Pipeline

Two-stage candidate generation and ranking, online/offline feature store skew prevention, and freshness caches at Netflix scale.

NetflixTikTokYouTube
Published (21)
1 System Guide · 20 Algorithm Sims

20 algorithm traces with step-by-step code notes and variable watches, 1 distributed KV cache guide, 2 system design scenarios, and 48 pattern-mapping prompts.