Back to Notes

Interview KB — Master Index

Interview KB — Master Index

Standalone interview-prep knowledge base — every page here cross-links only to other pages inside this KB, nothing external. One deep page per problem, one small focused page per concept/sub-topic. All content Senior/Staff level, code included (Python/Go/JS) wherever a topic is concretely codeable.

Study order: SD Concepts → SD HLD → SD LLD → Python → Databases → Go → Frontend.


1. System Design — Concepts (20)

Foundational building blocks — read before the HLD problem set; every problem page assumes this vocabulary.

PageSummary
[[Core Vocabulary & Quality Pillars]]SLA/SLO/SLI, throughput/latency, and the four quality pillars (scalability, reliability, availability, maintainability)
[[Back-of-Envelope Estimation]]Numbers to memorize (powers of 2, latency ladder), the 5-quantity QPS/storage/bandwidth recipe, worked Twitter-scale example, sanity-check ceilings
[[CAP Theorem & Consistency Models]]CAP trade-off, PACELC extension, and the strong/eventual/causal consistency spectrum
[[Latency vs Throughput]]The two optimization axes, plus the cache hit-rate math formula used across every caching decision
[[Load Balancing]]Static vs dynamic LB algorithms, why simple hashing fails, sticky vs non-sticky sessions
[[Proxies (Forward vs Reverse)]]The forward/reverse distinction and why a CDN is a reverse proxy
[[Database Replication & Sharding]]Primary-replica replication, partitioning vs sharding, range/hash/directory sharding strategies
[[Single Point of Failure]]What creates a SPOF, mitigation patterns, the CAP-theorem caveat on eliminating them
[[Service Discovery & Health Checks]]Heartbeats, two-way health checks, availability-biased design
[[SD Interview Framework & Pitfalls]]The 6-step HLD framework, evaluation criteria, scalability evolution table, common pitfalls
[[SQL vs NoSQL]]Access-pattern-first decision framework across KV/document/column-family/graph stores
[[CDN]]Push vs pull CDN, cache invalidation via versioned URLs vs TTL
[[Communication Protocols]]Polling, long-polling, WebSockets, SSE, gRPC — with Python code for each
[[Blob & Object Storage]]Pre-signed URLs, chunking, why metadata and bytes live in separate stores
[[Caching & Redis]]Cache strategies, eviction, stampede, Redis internals (single-thread I/O multiplexing, persistence, Lua atomicity)
[[Consistent Hashing]]The ring + virtual nodes mechanism, hot keys, data movement on node add/remove — tiered by interview priority
[[Merkle Trees]]Hash-tree anti-entropy repair — root-hash comparison, pruning matching subtrees, O(log n) vs O(n)
[[Message Queues & Kafka]]Partitions, consumer groups, delivery guarantees, Kafka vs SQS vs RabbitMQ
[[API Design Principles]]REST conventions, idempotency keys, cursor pagination, status codes, JWT/OAuth
[[API Gateway]]Gateway vs reverse proxy vs service mesh, BFF pattern, routing/auth middleware skeleton

2. System Design — HLD (17)

Deep, single-problem walkthroughs — requirements → capacity math → architecture → the one hard sub-problem → drills.

PageSummary
[[Design a URL Shortener]]Short-code generation (hash/counter/KGS), base62, 301 vs 302, the exemplar depth page
[[Design a Unique ID Generator]]Snowflake bit-budget breakdown (Python), clock-skew handling, vs UUID/ticket-server/multi-master
[[Rate Limiter]]Token bucket vs sliding window, distributed atomicity via Lua, fail-open/closed
[[News Feed - Twitter Feed]]Hybrid push/pull fan-out, Snowflake IDs, the celebrity-account failure mode
[[WhatsApp Chat]]WebSocket cross-server routing via Redis pub/sub, idempotent delivery, presence
[[Notification System]]Priority-tier queue isolation, exponential backoff + DLQ, digesting for frequency capping
[[Typeahead - Autocomplete]]Trie with cached top-K per node — the O(1)-per-query insight, batch rebuild trade-off
[[Web Crawler]]Two-tier polite URL frontier, Bloom filter dedup, crawler-trap mitigation
[[Distributed Key-Value Store]]Dynamo-style N/W/R quorum, vector clocks, hinted handoff, gossip membership
[[Payment System]]Idempotency-key reservation, append-only double-entry ledger, CP-not-AP framing
[[Uber - Ride Sharing]]Geohash/H3 geospatial indexing, Redis GEOADD, atomic driver-reservation race
[[YouTube - Video Streaming]]DAG transcoding pipeline, adaptive bitrate player (Python), CDN cache-key design
[[Dropbox - File Storage & Sync]]Content-addressed chunking, dedup + resumable upload, conflicted-copy resolution
[[Ad-Click Aggregation]]Event-time vs processing-time windowing, tunable grace period, exactly-once via idempotent writes
[[Distributed Job Scheduler]]Leased atomic job claims, retry/backoff, lease-heartbeat for long-running jobs
[[Google Docs]]OT vs CRDT conflict resolution (both implemented in Python), optimistic local apply
[[Distributed Message Queue]]Kafka internals — append-only log, partition hashing, consumer offsets, acks/ISR

3. System Design — LLD (11)

Class-design/machine-coding rounds — SOLID + design patterns first, then 8 canonical problems, all in Python.

Foundations

PageSummary
[[LLD Interview Approach]]The 5-step LLD framework (clarify → entities → interface → implement → extensibility)
[[SOLID Principles]]All 5 principles with the Liskov square/rectangle trap worked through in detail
[[OOD Design Patterns]]Strategy, Observer, Factory, Decorator, Singleton, State — with Python and interview tells for each

Problems

PageSummary
[[Parking Lot]]Strategy pattern for pricing, lock-granularity concurrency trade-off, EV-charging extensibility
[[Elevator System]]SCAN/LOOK algorithm, State + Strategy patterns, elevator selection strategies
[[LRU Cache]]OrderedDict fast path + from-scratch doubly-linked-list version, sharding for scale
[[Rate Limiter (OOD)]]Class-design token bucket/sliding window, per-client lock granularity, contrasted with the HLD version
[[Splitwise]]Strategy pattern for split types, greedy debt-simplification algorithm
[[Board Game]]Naive O(N) win-check → O(1) running-sum optimization, K-in-a-row generalization
[[Vending Machine]]The canonical State-pattern problem, vs. the rejected boolean-flags alternative
[[Notification System (OOD)]]Factory + Observer patterns, per-channel failure isolation, bridges to the HLD/Kafka version

4. Python (11)

Core language internals, then the 4 libraries used across the whole backend.

Core

PageSummary
[[Identity, Mutability & Memory]]is vs ==, mutable default argument gotcha, shallow/deep copy, refcounting + GC
[[Python Scoping & Closures]]LEGB, closures, the late-binding loop-variable gotcha and its fix
[[Python Decorators]]The 3-level nested pattern, functools.wraps, dependency injection via decorator args
[[Python Generators & Iterators]]Lazy evaluation vs list materialization, yield/StopIteration, context managers
[[Python OOP & Data Model]]Four pillars precisely distinguished, MRO/super(), dunder methods, @dataclass
[[Python Concurrency]]GIL decision framework — when to reach for threading vs multiprocessing vs asyncio
[[Python Gotchas Cheat Sheet]]Fast-recall table of every gotcha above, plus DSA built-ins reference

Libraries

PageSummary
[[Asyncio]]Event loop, gather/TaskGroup, semaphore concurrency capping, producer/consumer queue
[[Pydantic]]BaseModel validation, field/model validators, discriminated unions, model_config
[[FastAPI]]DI system, response_model as an output-shape security boundary, background tasks vs real queues
[[Python Logging]]Log levels/hierarchy, structured JSON logging, lazy %s formatting vs eager f-strings

5. Databases (17)

SQL in depth (15 pages), then Postgres/MongoDB internals. Redis is covered in [[Caching & Redis]] under SD Concepts, not duplicated here.

SQL

PageSummary
[[SQL Basics & Query Fundamentals]]SELECT/WHERE/NULL handling, the relational-division query pattern, execution order
[[SQL JOINs]]INNER/LEFT/FULL OUTER/self-join, the anti-join NULL trap with NOT IN
[[SQL Aggregates & GROUP BY]]Aggregate NULL behavior, HAVING vs WHERE, ROLLUP/GROUPING SETS
[[SQL Window Functions]]RANK family, LAG/LEAD, ROWS vs RANGE frames, the LAST_VALUE default-frame gotcha
[[SQL Subqueries & CTEs]]Correlated subqueries, EXISTS vs IN, recursive CTEs and cycle prevention
[[SQL String & Date Functions]]String/date function reference, the index-defeating EXTRACT() rewrite
[[SQL UNION & Set Operations]]UNION vs UNION ALL, INTERSECT/EXCEPT, the column-count-mismatch gotcha
[[SQL Pivoting]]Manual pivot via CASE WHEN + MAX/SUM/COUNT, the aggregate-choice template
[[SQL Indexes & Query Performance]]B-tree/GIN/GiST, composite index left-prefix rule, EXPLAIN ANALYZE, N+1
[[SQL Transactions & ACID]]Isolation levels and the three read phenomena, locking, MVCC, 2PC
[[SQL Constraints & Schema DDL]]The six constraints, DELETE vs TRUNCATE vs DROP, FK index requirement
[[SQL Views, Procedures & Triggers]]Materialized views, stored procedure trade-offs, trigger timing and risks
[[SQL Security & Injection Defense]]Parameterized queries, why blocklists fail, least-privilege DB users
[[SQL Classic Interview Problems]]Second-highest-salary, top-N-per-group, consecutive values, the Instacart case study
[[SQL Style & Best Practices]]Formatting, avoiding SELECT *, window functions over correlated subqueries

Postgres & MongoDB

PageSummary
[[Postgres Internals]]xmin/xmax tuple versioning, VACUUM/bloat, TOAST, WAL + replication, PgBouncer pooling
[[MongoDB]]Embed vs. reference modeling, sharding hot-shard risk, aggregation pipeline, transactions-as-modeling-smell

6. Go (14)

Senior-level Go internals — concurrency runtime mechanics, then interfaces/idioms.

Concurrency

PageSummary
[[Go Goroutines & Scheduling]]GMP scheduler model, work-stealing, Go 1.22 per-iteration loop-variable semantics
[[Go Channels]]Unbuffered vs buffered, close/nil-channel axioms, select randomization
[[Go Context & Cancellation]]Cooperative cancellation tree, Done() channel mechanics, WithoutCancel
[[Go Sync Primitives]]Mutex/RWMutex internals, WaitGroup, Once, Cond, sync/atomic
[[Go Concurrency Patterns]]Worker pools, fan-out/fan-in pipelines, errgroup
[[Go Race Conditions & Memory Model]]ThreadSanitizer internals, the happens-before edge list to memorize
[[Go Goroutine Leaks]]The leak checklist, why GC can't collect a parked goroutine, pprof/goleak

Idioms & Interfaces

PageSummary
[[Go Interface Internals]]Method sets, itab/eface layout, the typed-nil trap
[[Go Type Assertions & Generics]]Comma-ok assertions, any, GCShape stenciling and dictionaries
[[Go Embedding & Dependency Injection]]Method promotion (not inheritance), consumer-defined interfaces idiom
[[Go Error Handling]]%w/errors.Is/errors.As/errors.Join, sentinel vs custom error types
[[Go Data Structure Internals]]Slice header/append aliasing, map bucket internals, struct alignment padding
[[Go Receivers & Control Flow]]Value vs pointer receiver rules, defer/panic/recover mechanics
[[Go Zero Values, Enums & Options Pattern]]Zero-value-usable API design, iota enums, functional options pattern

7. Frontend (10)

JavaScript core, then React, then HTML/CSS.

JavaScript

PageSummary
[[JS Core Language & Data Types]]Data types/typeof gotchas, == vs ===, hoisting/TDZ, Map/Set complexity
[[JS Closures & Async]]The loop+closure gotcha, this/bind/call/apply, Promise combinators, event loop
[[JS Prototype & OOP]]Prototype chain, prototypal vs classical inheritance, localStorage vs cookies
[[JS Machine Coding Patterns]]Debounce/throttle, curry, Promise polyfills, cycle-safe deep clone
[[JS DOM & Events]]Node vs Element traversal, event delegation, layout thrashing, XSS via innerHTML

React

PageSummary
[[React Hooks Deep-Dive]]useState/useEffect/useRef/useMemo/useCallback/useContext/useReducer, stale closures
[[React Patterns & State Management]]Controlled vs uncontrolled, composition, prop drilling fixes, state-management decision tree
[[React Performance & Reconciliation]]Virtual DOM diffing, the key-as-index bug, React.memo traps, virtualization
[[React Machine-Coding (Frontend System Design)]]Typeahead, infinite scroll, WebSocket dashboard, complex forms — real component code

HTML & CSS

PageSummary
[[HTML & CSS Fundamentals]]Box model, positioning gotcha, Flexbox vs Grid, specificity, z-index stacking contexts

Total: 100 pages. All standalone within this KB — no page links outside Interview KB/ except where explicitly noted (Redis → [[Caching & Redis]]).