5d ago 路 17 min read 路 TLDR TLDR: A Parking Lot is the "Hello World" of Low-Level Design. It teaches Encapsulation (ParkingFloor hides its Min-Heap), Abstraction (PricingStrategy interface), Inheritance (BikeSpot/CompactSpot/LargeSpot extend ParkingSpot), and Polymorphism...
Join discussion5d ago 路 21 min read 路 TLDR TLDR: A Movie Booking System (like BookMyShow) is an inventory management problem with an expiry: seats expire when the show starts. The core engineering challenge is preventing double-booking under concurrent user load with a 3-state seat mode...
Join discussion5d ago 路 19 min read 路 TLDR TLDR: A URL Shortener maps long URLs to short IDs. The core challenge is generating a globally unique, short, collision-free ID at scale. We use Base62 encoding on auto-incrementing database IDs for deterministic, collision-free short codes. ...
Join discussion5d ago 路 19 min read 路 TLDR TLDR: An LRU (Least Recently Used) Cache evicts the item that hasn't been accessed the longest when it's full. The classic implementation combines a HashMap (O(1) lookup) with a Doubly Linked List (O(1) move-to-front) for overall O(1) get and p...
Join discussion5d ago 路 19 min read 路 TLDR TLDR: An elevator system is a textbook OOP design exercise: ElevatorCar encapsulates its stop queue, ElevatorState polymorphically handles direction changes (State Pattern), and DispatchStrategy keeps assignment algorithms swappable (Strategy P...
Join discussion5d ago 路 25 min read 路 TLDR: This is the code companion to the Parking Lot System Design post. We implement the core classes (ParkingLot, ParkingSpot, Ticket) in Java, apply the Singleton, Factory, and Strategy patterns, and use a Min-Heap to find the nearest available spo...
Join discussion