Advanced LLD Case Studies

Tackle designs asked by product companies: Splitwise, BookMyShow, a rate limiter, an LRU cache, a food delivery system and an in-memory key-value store.

Advanced · about 14 hours · difficulty 4/5

Learn first: Classic LLD Case Studies, Concurrency and Synchronization

Product companies in India (Flipkart, Swiggy, PhonePe, Razorpay and others) prefer prompts closer to their own domains. These add business rules, concurrency and data-structure choices on top of basic modelling.

The advanced set

  • Splitwise: users, groups, expenses with equal, exact and percentage splits (Strategy), balance sheets, and simplifying debts (a greedy heap-based algorithm).
  • BookMyShow / movie ticket booking: theatres, screens, shows, seats, and the core challenge of concurrent seat booking. Discuss temporary seat locks with expiry, and optimistic vs pessimistic locking.
  • Rate limiter: token bucket, leaky bucket, fixed and sliding window algorithms behind a common interface. Thread-safe counters per user.
  • LRU cache: hash map plus doubly linked list for O(1) get and put. Extend to LFU and to a thread-safe version.
  • Food delivery or ride hailing: order lifecycle with the State pattern, delivery partner assignment via Strategy, and notifications via Observer.
  • In-memory key-value store: get, set, delete, TTL expiry and optional transactions (begin, commit, rollback with a stack of change sets).
  • Others worth a look: a cab booking app, a stock exchange order matching engine, a pub-sub queue, a snake game with a leaderboard.

Skills these add

  • Picking the right data structures inside a design (heaps, ordered maps, linked lists).
  • Concurrency: locks per resource rather than one global lock, and atomic operations.
  • Making business rules pluggable so new split types or pricing need no core changes.

Good enough to move on: you can implement LRU cache and a thread-safe rate limiter from scratch and explain how BookMyShow avoids double-booking.

Key concepts

  • Splitwise and debt simplification
  • Movie ticket booking and seat locking
  • Rate limiter algorithms
  • LRU and LFU cache
  • Food delivery or ride hailing
  • In-memory key-value store with TTL
  • Order matching engine
  • Pub-sub message queue

Mini project

Build a Splitwise clone as a CLI with equal, exact and percentage splits and a simplify-debts command, plus a thread-safe token bucket rate limiter with a test that fires 1000 concurrent requests and asserts the allowed count.

Check yourself

Two users click the same seat for the same show within milliseconds. Walk through how your booking design guarantees only one succeeds.

Free resources