Articles
Everything, one deep dive at a time
Start typing to find a topic, tag, or article — 105 published.
105 articles
All articles
Arrays and Dynamic Arrays: Random Access and Amortized O(1) Append
A diagram-first guide to the array and dynamic array data structure: O(1) random access, why append is amortized O(1) via doubling, time complexity, and interview questions.
Balanced Search Trees: How AVL and Red-Black Trees Stay Fast
Balanced search trees explained: AVL and red-black, the self-balancing binary search tree data structure that guarantees O(log n). Rotations, time complexity, and interview questions.
Big-O and Time Complexity: Reading an Algorithm’s Cost Straight Off the Code
A diagram-first guide to Big-O notation and time complexity analysis: the growth classes from O(1) to O(n!), reading complexity off code, space complexity, amortized analysis, and interview prep.
Binary Search: Halving a Sorted World Down to One Answer
A diagram-first guide to the binary search algorithm: the lo/hi/mid loop, avoiding overflow, lower and upper bound, binary search on the answer, O(log n) time complexity, and interview prep.
Binary Search Trees: One Rule for Fast Search, Insert, and Delete
A diagram-first guide to the binary search tree data structure and its algorithms: search, insert, in-order sort, and the three delete cases, with time complexity and interview questions.
Binary Trees Explained: Traversals, Height, and Why In-Order Is Sorted
A diagram-first guide to the binary tree data structure: nodes, terminology, the three DFS traversals plus level-order BFS, height and time complexity, and a complete interview-ready implementation.
Breadth-First Search: Finding the Shortest Path One Ripple at a Time
The breadth-first search (BFS) algorithm: explore a graph level by level with a queue, find the shortest path in an unweighted graph, grid and multi-source BFS, time complexity, and interview prep.
Coding Questions to Memorise: The Pattern Templates That Crack the Coding Interview
Coding questions to memorise for interviews: the pattern templates — two pointers, sliding window, binary search, backtracking, DP — that solve most coding interview questions from memory.
Concurrency Patterns: The Reusable Shapes for Safe Multithreaded Design
Concurrency patterns explained: producer-consumer, thread pool, future, read-write lock, thread-safe singleton, and a semaphore-bounded pool for safe multithreaded design.
Depth-First Search: Go Deep, Backtrack, and the Three-Colour Cycle Trick
The depth-first search (DFS) algorithm explained: recursion vs an explicit stack, three-colour cycle detection, connected components, flood fill, O(V+E) time complexity, and interview questions.
Design Patterns Explained: The Gang-of-Four Patterns That Show Up in LLD Rounds
Design patterns explained for interviews and low-level design: the Gang of Four patterns — factory, builder, singleton, adapter, decorator, strategy, observer, state, template method, command.
Dynamic Programming: Turning Exponential Recursion Into Linear Time by Remembering
The dynamic programming algorithm explained: memoization vs tabulation, optimal substructure, overlapping subproblems, the 0/1 knapsack, time complexity, and interview prep.
The Graph: How Software Models Maps, Friends, and the Web
A diagram-first guide to the graph data structure: vertices and edges, adjacency list vs matrix, degree, connected components, time complexity, and a complete implementation for interviews.
Greedy Algorithms: When Grabbing the Best Right Now Actually Works
A diagram-first guide to greedy algorithms: interval scheduling, the exchange argument that proves a greedy choice is safe, where greedy fails, time complexity, and interview prep.
Hash Tables Explained: How Maps and Sets Get O(1) Lookups
A diagram-first guide to the hash table data structure: hashing, buckets, collisions, chaining, load factor, resize, equals/hashCode contract, time complexity, and hash map interview questions.
Heaps & Priority Queues Explained: The Binary Heap Behind Always-Next-Urgent
A friendly, diagram-first guide to the binary heap and priority queue data structure: the array embedding, sift-up and sift-down, heapify, time complexity, and interview follow-ups.
Linked Lists Explained: Nodes, Pointers, In-Place Reversal, and Floyd's Cycle Detection
A diagram-first guide to the linked list data structure: singly vs doubly linked nodes, O(1) splicing, in-place reversal, Floyd cycle detection, plus time complexity and interview prep.
Object-Oriented Programming Explained: The Four Pillars and Composition Over Inheritance
Object-oriented programming explained for interviews: encapsulation, abstraction, inheritance, polymorphism, and composition over inheritance (is-a vs has-a) with a worked payment-system example.
Queues and Deques: FIFO, the Circular Buffer, and the Sliding-Window Trick
A diagram-first guide to the queue and deque data structure: FIFO enqueue and dequeue, the circular buffer (ring) fix, sliding window maximum, time complexity, and interview questions.
Recursion and Backtracking: Trusting a Smaller Version of the Problem
Recursion and backtracking explained with diagrams: base case, call stack, choose-explore-unchoose, pruning, time complexity, and interview code for subsets, permutations, and N-queens.
Sliding Window: Turning O(n²) Subarray Scans Into One Clean Pass
The sliding window algorithm explained: fixed and variable windows, the two-pointer technique, amortized O(n) time complexity, and interview code for max subarray sum and longest substring.
SOLID Design Principles: The Five Rules That Make an Object-Oriented Design Interview-Ready
The SOLID design principles explained with code: single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion, plus DRY, KISS and YAGNI for low-level design.
Sorting Algorithms: Merge Sort, Quicksort, and Why a Bad Pivot Costs You O(n²)
A diagram-first guide to sorting algorithms: insertion sort, merge sort, quicksort partition and pivot, heap sort, stability, the O(n log n) lower bound, time complexity, and interview prep.
The Stack: Undo, Recursion, and the O(n) Trick Interviewers Love
The stack data structure (LIFO) explained: push, pop, peek in O(1), the call stack behind recursion, and the monotonic stack, with time complexity and a full implementation for your coding interview.
Topological Sort: Ordering a DAG So Every Prerequisite Comes First
The topological sort algorithm on a DAG: Kahn's algorithm with in-degrees and DFS post-order, how it detects a cycle, O(V+E) time complexity, and interview questions.
Two Pointers: Turning an O(n²) Pair Hunt Into a Single O(n) Walk
The two pointers algorithm explained: converging and fast/slow pointers, two-sum on a sorted array, valid palindrome, container with most water, O(n) time complexity, and interview prep.
Union-Find (Disjoint Set Union): Merging Groups in Almost No Time
A diagram-first guide to the union-find (disjoint set union) data structure: find and union, path compression, union by rank, near-constant time complexity, and interview code.
Cab Ride Allocator: a Concurrency Barrier Problem (the Uber ride question)
The Uber ride concurrency interview question: seat ride-request threads into cabs of four — 4+0, 0+4, or 2+2 only — with a mutex, two semaphores, and a barrier. Deadlock-free, stress-tested.
Prime Video HLD: The Transcoding Pipeline Behind Streaming Video
How a streaming service prepares video: splitting a master into segments, fanning out parallel transcode jobs across a segment-by-rendition matrix, progressive playability, and serving from the edge.
Mentorship Platform HLD: Matching Mentees to the Right Mentor
How a mentorship platform like Preplaced matches people: hard filters that remove the unqualified, a weighted skill-overlap score that ranks the rest, and the search-match-book architecture.
Topmate HLD: Booking Paid 1:1 Sessions Without Double-Booking
How a creator-session platform works inside: turning availability windows into bookable slots, the interval-overlap test that prevents double-booking, and the hold-pay-confirm flow.
Crypto Exchange HLD: The Double-Entry Ledger That Never Loses a Coin
How a crypto exchange tracks money correctly: a double-entry ledger where balanced transactions conserve value, overdrafts are impossible, plus hot/cold wallet custody and the deposit/withdraw flow.
ngrok HLD: Exposing localhost to the Internet With Reverse Tunnels
How a secure tunneling service works inside: the reverse tunnel that needs no open firewall port, stream multiplexing many requests over one connection, and subdomain routing at the edge.
Google Docs HLD: Operational Transformation for Real-Time Co-Editing
How Google Docs lets many people edit one document at once: why naive concurrent edits diverge, how Operational Transformation rewrites operations to converge, and the central-server OT architecture.
Gmail HLD: Storing Billions of Mailboxes and Threading Conversations
How an email service works inside: accept-fast ingestion, the shared message store plus per-user mailbox index, conversation threading by reply headers with union-find, and per-user search.
Alexa HLD: How a Voice Assistant Turns Speech Into Action
How a voice assistant works inside: the wake-word-to-speech pipeline, the NLU layer that resolves an utterance to an intent and slots, the thin-device cloud-brain split, and the skill fan-out.
Game Engine LLD: The Fixed-Timestep Loop and Entity-Component-System
The two ideas at the core of a game engine: a fixed-timestep loop that makes simulation deterministic at any frame rate, and an Entity-Component-System that composes behaviour without inheritance.
GitHub's Data Model: How to Store Version History in a Database
Modelling version control in a database the way Git does: content-addressable blobs, trees and commits as a Merkle DAG, structural sharing of unchanged files, and the two-table schema that backs it.
AWS Lambda HLD: How Serverless Runs Your Code Without a Server
How a serverless platform works inside: the invocation path, cold versus warm starts, the scheduler that reuses execution environments, concurrency-limited autoscaling, and where latency goes.
NoSQL Internals HLD: The LSM Tree That Makes Writes Cheap
How a write-optimized NoSQL store works inside: the LSM tree (memtable, write-ahead log, immutable SSTables), the read path with bloom filters, compaction and tombstones, and LSM versus B-tree.
LinkedIn HLD: Degrees of Separation on a Billion-Edge Graph
A LinkedIn system design: the connection graph, degrees of separation via BFS, People You May Know ranked by mutual connections, why deep traversal is precomputed, and scaling the graph.
Tinder HLD: Mutual Matches, a Swipe Firehose, and a Fresh Deck
A Tinder system design: mutual-match detection that fires exactly once, the recommendation deck from a geospatial index, the swipe write firehose, privacy of one-sided likes, and scaling.
Zoom HLD: Why Video Calls Use an SFU, Not a Mesh
A Zoom / video-conferencing system design: mesh vs SFU vs MCU topologies, an SFU that uploads once and fans out, simulcast layer selection, signaling vs media, NAT traversal, and scaling rooms.
Dropbox / Google Drive HLD: Sync That Only Moves What Changed
A file sync system design (Dropbox / Drive): content-addressed chunks with dedup, delta sync that uploads only changed chunks, the metadata-vs-block split, and conflict handling.
AWS S3 HLD: Object Storage That Loses Nothing (Erasure Coding)
An AWS S3 system design: a flat bucket/key namespace, durability via erasure coding across AZs, the metadata index mapping keys to shards, multipart upload, and how object storage scales.
Load Balancer HLD: The Front Door That Never Sends You to a Dead Server
A load balancer system design: balancing algorithms (round-robin, least-connections, consistent hashing), health checks, L4 vs L7, and keeping the balancer itself from being a single point of failure.
Google Maps HLD: Fastest Route on a Planet-Sized Graph
A Google Maps system design: modelling roads as a weighted graph, A* routing with an admissible heuristic, precomputation for continent scale, live-traffic edge weights, and map tiles.
WhatsApp HLD: Real-Time Chat for Billions, Online or Off
A WhatsApp / chat-at-scale system design: persistent connections and a routing registry, store-and-forward for offline users, idempotent ordered delivery, and the delivery-tick receipts.
HackerRank CodePair HLD: Two People, One File, No Conflicts
A real-time collaborative editor design (CodePair / Google Docs-style): a sequence CRDT with fractional positions, converging concurrent edits over WebSockets, presence, and per-room scaling.
BitTorrent HLD: Downloading From Strangers, With No Server
A BitTorrent system design: splitting a file into hashed pieces, the peer swarm and tracker, rarest-first piece selection, tit-for-tat incentives, and why P2P scales up as demand grows.
Zerodha HLD: The Matching Engine at the Heart of a Stock Exchange
A stock exchange system design (Zerodha): a limit order book with price-time priority, the matching algorithm, an in-memory engine kept durable by a journal, and correctness over availability.
Amazon HLD: The Cart That Never Says No (Dynamo, Quorums, Merge)
An Amazon system design on the always-available shopping cart: AP over CP, a Dynamo-style replicated key-value store, quorums, consistent hashing, and merging divergent carts.
OYO / Airbnb HLD: Find Places Near Me, Free for My Dates
An Airbnb / OYO system design: geospatial search with geohash prefixes, date-range availability, booking without double-booking, the data model, and scaling location search.
Google Calendar DB Design: Store the Recurrence Rule, Not a Million Rows
A database deep dive on modelling Google Calendar: storing a recurrence rule instead of infinite instances, expanding on read, cancellations and overrides, timezones/DST, and time-range queries.
Spotify HLD: Streaming Audio That Starts Fast and Never Stalls
A Spotify system design: storing audio as a chunked bitrate ladder in object storage behind a CDN, adaptive bitrate selection from bandwidth and buffer, the metadata model, and play history at scale.
Stack Overflow HLD: Search Is the System, and It Isn't a SQL LIKE
A Stack Overflow system design: full-text search via an inverted index ranked by TF-IDF and votes, a read-heavy cache/CDN path, the Q&A data model, and keeping search in sync with the source of truth.
Cricinfo Live Score HLD: Serving One Hot Score to Millions of Readers
A live cricket score system design (Cricinfo-style): read fan-out to tens of millions, collapsing a hot key with caching and single-flight, push vs poll delivery, and freshness over consistency.
Reddit Comments DB Design: Modelling a Threaded Tree That Scales
A database deep dive on modelling Reddit-style threaded comments in SQL: adjacency list vs materialized path vs closure table, fetching a subtree in one query, plus scores and sharding by post.
Newsletter Service HLD: Fan Out a Million Emails Without Sending Twice
A newsletter service system design: fan a campaign out to millions of subscribers, the send-log idempotency key that stops double-sends, plus deliverability, retries, and open/click tracking.
Ad Click Aggregation HLD: Counting a Firehose Without Keeping It
An ad click event aggregation system design (HLD): tumbling windows, exactly-once counting by dedup, the Count-Min Sketch for fixed-memory counts, and stream processing with a batch recompute.
Real-Time Leaderboard HLD: Your Rank Among 50 Million, Instantly
A real-time leaderboard system design (HLD): why top-N is easy but a single player's rank is hard, the sorted set and order-statistics that make rank O(log n), time windows, and the hot-key at scale.
Twitter HLD: Fan-Out, the Celebrity Problem, and Merging a Timeline
A Twitter / X news feed system design (HLD): fan-out on write vs read, the celebrity problem, the push-pull hybrid, and assembling a timeline by merging K sorted streams at scale.
Ride Sharing HLD: Finding the Nearest Driver Without Asking All of Them
A ride sharing system design (Uber/Ola-style): the geospatial cell index that finds nearby drivers fast, the driver offer as a hold with a TTL, the double-match race, and surviving a hot region.
Movie Ticket Booking HLD: The Seat Hold Is the Whole System Design
A movie ticket booking system design (BookMyShow-style): the data model, a seat-hold with a TTL, stopping double-booking with an atomic update, and idempotent payment at scale.
Web Crawler LLD: A Frontier, a Seen-Set, and the Trick Question of When You're Done
A low-level design walkthrough of a web crawler core: the frontier queue, URL normalization before deduplication, a shared seen-set, per-host politeness, and termination by in-flight count.
Online Voting LLD: The Design Where You Destroy the Join on Purpose
A low-level design walkthrough of an online voting system: separating eligibility from the ballot so one vote per voter never links who voted to what, with an append-only, recountable tally.
Music Recognition LLD: How Shazam Turns a Noisy Hum into a Constellation of Hashes
A low-level design walkthrough of audio fingerprinting like Shazam: reducing a spectrogram to peak landmarks, hashing point pairs, and matching a noisy snippet by voting on a consistent offset.
Google Authenticator LLD: Two Devices, No Connection, One Six-Digit Truth (TOTP)
A low-level design walkthrough of TOTP and Google Authenticator: a shared secret and the clock through HMAC to six digits, with an acceptance window that tolerates skew and blocks replay.
Text Editor Core LLD: The Gap Buffer and Undo That Knows Its Own Inverse
A low-level design walkthrough of a text editor core like Sublime: the gap buffer for fast cursor-local edits, plus undo/redo stacks built from edits that describe their own inverse.
Internet Download Manager LLD: Byte Ranges, Parallel Couriers, and a Crash-Proof Journal
A low-level design walkthrough of a download manager: splitting a file into byte-range segments, downloading them in parallel with retries, and resuming after a crash from an on-disk journal.
Bar Graph Library LLD: A Chart Is a Function from Numbers to Pictures
A low-level design walkthrough of a bar graph chart library: series data, a linear scale with nice ceilings, and pluggable renderers that draw the same chart in the console and as SVG.
Coupon System LLD: Rules Marketing Can Edit, Money That Can't Lie
A low-level design walkthrough of a coupon and promo system: eligibility rules as composable data, discounts with caps, the preview-redeem split, and usage limits that survive a rush.
Android Unlock Pattern LLD: Nine Dots, One Skip Table, 389,112 Secrets
A low-level design walkthrough of the Android unlock pattern: the crossing rule as a lookup table, pattern validation in O(1) per move, and counting all valid patterns with backtracking and symmetry.
Online Book Reader LLD: The Bookmark Is the Whole Design
A low-level design walkthrough of an online book reader system: a catalog of shared books, per-user sessions, page navigation that clamps at the covers, and the user-book bookmark as the hidden noun.
Car Rental LLD: Book the Count, Assign the Car at the Counter
A low-level design walkthrough of a car rental system: reservations against category capacity instead of specific cars, interval counting on the calendar, pickup-time assignment, and late-fee billing.
Thread Pool LLD: Build ExecutorService's Heart by Hand
A low-level design walkthrough of a thread pool: the bounded work queue, the worker loop that must never die, saturation and rejection, and the graceful shutdown promise — fully tested.
Splitwise LLD: Where Every Rounding Paisa Must Find a Home
A low-level design walkthrough of a Splitwise expense sharing system: immutable expenses, derived balances, split strategies with the rounding paisa rule, and greedy debt simplification.
Call Center LLD: Dispatch, Escalation, and the Freed Agent
A low-level design walkthrough of a call center: rank-based dispatch across respondents, managers and a director, escalation that re-dispatches, queues per rank, and the freed agent who drains them.
Elevator LLD: The Sweep That Schedules Your Building (and Your Disks)
A low-level design walkthrough of an elevator system: why first-come-first-served zigzags, the LOOK sweep algorithm, hall calls vs car calls, direction as state — fully implemented and tested.
Alarm Service LLD: Why CloudWatch Doesn't Page You for One Bad Second
A low-level design walkthrough of an AWS-style alarm and alert service: threshold rules as data, consecutive-breach debouncing, three honest states, and observers notified on transitions only.
Airline Management LLD: Seats Have Names, and Holds Have Timers
A low-level design walkthrough of an airline booking system: identity inventory where seat 12A is nobody's substitute, the PNR as hidden noun, and seat holds that expire by the lazy clock.
Hotel Management LLD: The Calendar Is the Hard Part
A low-level design walkthrough of a hotel management system: half-open date ranges, the one-line overlap formula, booking a room type while the hotel assigns the room — fully implemented.
Inventory Management LLD: The Oversell Bug and the Reserve That Kills It
A low-level design walkthrough of an inventory management system: on-hand vs reserved vs available, two-phase reservations with commit and release, and the race that double-sells the last unit.
Restaurant Management LLD: Four State Machines Holding Hands
A low-level design walkthrough of a restaurant management system: seating by table fit, order tickets through a kitchen queue, and billing that frees the table — coordinated state machines.
File System LLD: The Composite Pattern's Home Turf
A low-level design walkthrough of an in-memory file system: files and directories behind one Node interface, path resolution as a walk, recursive size via the Composite pattern — fully implemented.
JSON Parser LLD: Recursive Descent, Demystified in 200 Lines
A low-level design walkthrough of a JSON parser: the grammar as a call graph, recursive descent with a position cursor, escape and number handling, and error messages that point.
Logging Library LLD: Build log4j's Skeleton in One Sitting
A low-level design walkthrough of a logging library: ordered levels, a cheap threshold gate, formatters, appenders as a Strategy, and the complete implementation of the log4j shape.
ATM LLD: A State Machine You'd Trust with Your Salary
A low-level design walkthrough of an ATM: a state machine that retains cards after three wrong PINs, a bank service interface because the ATM owns no truth, and cash planned before any debit.
Chess LLD: Scope Like a Senior, Move Like a Strategy Pattern
A low-level design walkthrough of chess: scoping the unbuildable, one movement rule per piece via the Strategy pattern, a shared path-clear helper for sliding pieces, and the complete implementation.
Tetris LLD: One Collision Check Runs the Whole Game
A low-level design walkthrough of Tetris: why the falling piece never lives on the board, rotation as pure arithmetic, line clears as a filter, and the complete implementation of the classic.
Jackpot Machine LLD: Reels, a Paytable, and Money That Never Lies
A low-level design walkthrough of a jackpot slot machine: independent reels with injected randomness, the paytable as data instead of if-chains, and a credits ledger that always balances.
Minesweeper LLD: Two Grids, One Flood, and a Merciful First Click
A low-level design walkthrough of minesweeper: separating truth from view, the flood fill cascade done with discipline, first-click safety, and the complete implementation of the classic.
2048 LLD: One Merge Function Wearing Four Costumes
A low-level design walkthrough of the 2048 game: the merge-once rule everyone breaks, why all four directions are one mergeLeft function, win and lose detection, and the complete implementation.
Snake & Ladder LLD: One Map, One Die, and a Game You Can Test
A low-level design walkthrough of snake and ladder: why snakes and ladders are one Map, how injecting the die makes the game testable, and the complete implementation with a clean turn loop.
Vending Machine LLD: Where the State Pattern Earns Its Keep
A low-level design walkthrough of a vending machine: coins, inventory, the can't-make-change trap, and when design patterns earn their keep — the honest path from if-checks to the State pattern.
Tic-Tac-Toe LLD: The Warm-Up Interview You Should Never Lose
A low-level design walkthrough of tic tac toe (Tic-Tac-Toe): an O(1) win check with counters, a clean state machine, and the complete implementation of the classic warm-up interview question.
A Rookie's Guide to LLD: The Parking Lot and the Pattern Cheat Sheet
How to approach any low-level design interview: turn requirements into classes, methods, and state machines — the parking lot classic, fully built — plus a cheat sheet for picking design patterns.
A Rookie's Guide to HLD: Design Zomato with Nouns and Verbs
How to approach any high-level design interview: extract the data model and APIs from plain sentences — nouns, verbs, hidden tables — applied live to a Zomato-style food delivery system design.
Building a Rate Limiter: The Low-Level Design
A low-level design walkthrough of a rate limiter: the token bucket class, the race condition that breaks it, making it thread-safe, a per-client registry, and the complete implementation.
Streams, Explained: Functional Programming That Reads Like English
A friendly tour of the Stream API and functional programming: lambdas, pipelines, laziness, collectors — then interview questions on frequency counts, grouping, duplicates and second-highest.
Multithreading, Explained: From First Thread to Interview Favourites
A friendly tour of multithreading: threads, race conditions, synchronized, wait/notify — then the classic interview questions, odd-even printing, producer-consumer and deadlocks, solved and explained.
The Trie: How Autocomplete Finishes Your Sentences
A friendly, diagram-first tour of the trie (prefix tree), the data structure behind autocomplete: insert, search, and prefix lookups step by step, plus a complete implementation.
Designing a Thread-Safe LRU Cache
A low-level design walkthrough of an O(1) LRU cache — a hash map plus a doubly linked list — how eviction works, the locking story, and the full browsable implementation.
Dijkstra's Algorithm: How Your Map Finds the Fastest Route
A friendly, diagram-first walk through Dijkstra's shortest path algorithm: the ripple intuition, the invariant behind it, a step-by-step trace on a real graph, and a complete implementation.
Designing a Rate Limiter
The system design classic: where a rate limiter sits in your architecture, fixed window vs sliding window vs token bucket, going distributed with Redis, and a thread-safe core you can ship.