Library
Cheat sheets, pattern cards, problem write-ups and a glossary, for quick reference.
26 results
- AI system design interview questions
About 40 questions interviewers ask about systems built on language models, with the points a strong answer covers.
Cheat sheet - AI design patterns cheat sheet
Fourteen patterns for building on language models, each with what it is, when to use it and what to watch out for.
Cheat sheet - Design: search autocomplete
Answer every keystroke in under about 100 ms by ranking suggestions ahead of time, storing them by prefix, caching popular prefixes close to people and refreshing the lists safely.
Problem - Pattern card: caching
Keep copies of popular data in a fast store in front of a slow one. Hit rate decides how much load it removes, and TTLs plus deletes decide how stale a copy can get.
Pattern - Pattern card: CDNs
Copy content that is the same for everyone onto servers in many cities, so users fetch it nearby and your own servers see only the misses.
Pattern - Design: a chat app
Keep a live line to every online phone, save each message with a per-chat number before delivering it, and let any device catch up from the last number it has. Numbers, APIs, storage, groups and failure cases for a WhatsApp-scale chat on one page.
Problem - Back-of-envelope estimation cheat sheet
The handy numbers, formulas and worked sums for turning users and actions into requests a second, storage, bandwidth and servers, in under five minutes.
Cheat sheet - Design: a flash sale
Sell 5,000 phones to 10 lakh shoppers in seconds, never oversell, say a fast "no" to everyone else and keep the rest of the shop standing. Split stock counters, a waiting room, a sold-out flag at the edge and an order queue.
Problem - Pattern card: idempotency
Messages and requests will sometimes arrive twice. Name each action once, remember the names you have handled, and make a repeat return the first result instead of doing the work again.
Pattern - Design: a key-value store
A Dynamo-style store that spreads keys on a hash ring, keeps several copies, waits for a quorum and keeps taking writes while machines fail. The classic deep question on partitioning, replication and conflicts.
Problem - Latency numbers cheat sheet
Rough timings for memory, disk, networks across India and the world, and everyday operations, with the sums that turn them into design decisions.
Cheat sheet - Pattern card: load balancing
Spread requests across many identical servers so you can scale out, and use health checks so a dead server is skipped within seconds.
Pattern - Design: a news feed
Do the work when posts are written so opening the app is just reading a ready-made list of IDs, pull celebrity posts in at read time, then rank a shortlist inside a fixed time budget. Numbers, APIs, data model, ranking and follow-ups on one page.
Problem - Design: a notification system
One shared service takes alerts from every team, checks each person's rules, sends urgent ones in a fast lane and bulk ones at a steady pace, and makes sure each alert arrives once.
Problem - Design: a payment system
Charge every payment exactly once and account for every rupee, even when networks fail halfway. Idempotency keys, a payment state machine, a double-entry ledger, the outbox and daily reconciliation.
Problem - Pattern card: message queues
Reply fast and do slow work in the background, with a queue in between to absorb bursts. Delivery is at least once, so every job must be safe to run twice.
Pattern - Design: a rate limiter
Give every user, key or phone number a refilling allowance per action, check it in one atomic step against a shared counter at the front door, and answer 429 with a time to retry. Algorithms, numbers, failure modes and follow-ups on one page.
Problem - Pattern card: rate limiting
Give each user, device or key a refilling allowance per action, check it in one atomic step at the front door, and answer 429 with a time to retry when it runs out.
Pattern - Pattern card: replication
Keep several copies of the same data so many machines can share the reading and a spare can take over. The price is lag, and deciding which reads must go to the primary.
Pattern - Design: ride matching
Keep every driver's latest position in memory by map cell, search a few nearby cells, rank by real driving time, and claim each driver with one atomic step so nobody is booked twice.
Problem - Pattern card: sharding
Split one database's data across several databases by a shard key, when writes or total size outgrow one machine. Choose the key carefully and map it through slots or a hash ring so growth moves little data.
Pattern - Design: ticket booking
Sell every seat exactly once while lakhs of fans arrive in the same second. An atomic hold with an expiry, a virtual waiting room, keyed payments and a seat store that is the only truth.
Problem - Design: a URL shortener
Turn long links into short codes and redirect crores of clicks a day in a few milliseconds. The classic first interview problem, with the numbers, the code scheme, the cache and the 301-or-302 choice in one page.
Problem - Design: video streaming
Convert each upload once into a ladder of qualities cut into short pieces, store them cheaply, and serve them from servers near every viewer, because bandwidth is the bill that matters.
Problem - Design: a web crawler
Fetch a billion pages a month without hammering any website, skip what has been seen, dodge trap pages and keep busy pages fresh. A classic problem about politeness, deduplication and working in parallel.
Problem