Category
oop
4 articles in this category
LLD for LRU Cache: Designing a High-Performance Cache
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...
LLD for Elevator System: Designing a Smart Lift
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...
Implement LLD for Parking Lot: Code Walkthrough
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...

LLD for Tic-Tac-Toe: Designing an Extensible OOP Game
TLDR: Tic-Tac-Toe looks trivial — until the interviewer says "make it N×N with P players and pluggable winning rules." The key design decisions: a Board abstracted from piece identity, a Strategy Pattern for win conditions, and a Factory for player c...
