In this guide
- LLD vs HLD — What's the Difference and When Is Each Tested
- SOLID Principles — The Foundation of Every LLD Answer
- 8 Design Patterns Every Indian SWE Must Know for LLD
- The 45-Minute Machine Coding Framework
- 10 Classic LLD Problems with Full Solutions
- Company-Specific LLD Expectations
- 7 LLD Interview Mistakes That Get Candidates Rejected
- 4-Week LLD Preparation Plan
- FAQ
Vikram had 4 years of experience at a mid-sized Indian startup. He'd solved 300 LeetCode problems. His system design answers were solid. He got rejected at Razorpay. Twice.
Both rejections came from the same round: the machine coding / LLD round. Vikram could describe how to build a parking lot system verbally. But when asked to write the actual class structure — with proper interfaces, design patterns, and extensible code — he produced a 300-line God class with everything jammed in, no abstractions, and zero SOLID compliance.
The third time, he spent 3 weeks on LLD specifically. He got the offer. This guide is what he learned.
1. LLD vs HLD — What's the Difference and When Is Each Tested
| Dimension | Low Level Design (LLD) | High Level Design (HLD) |
|---|---|---|
| Focus | Class structure, OOP, design patterns | Distributed systems, scalability, architecture |
| Output | Class diagrams, working code, interfaces | Architecture diagrams, component interactions |
| Duration | 45–90 minutes (machine coding) | 45–60 minutes (whiteboard/discussion) |
| Tested at | 2–7 YoE, Indian unicorns (Razorpay, Swiggy, CRED, Meesho) | 4+ YoE, FAANG, senior/staff roles |
| Key skills | SOLID, design patterns, OOP, code quality | CAP theorem, databases, caching, queues, CDN |
| Example question | "Design a Parking Lot system with working code" | "Design Twitter's feed generation system" |
2. SOLID Principles — The Foundation of Every LLD Answer
SOLID is not just theory. In an LLD interview, interviewers actively look for whether your class design follows these principles — and will ask you to refactor if it doesn't.
A class should have only one reason to change. Each class does exactly one thing.
Interview application: Don't put billing logic, notification logic, AND booking logic in a single BookingService. Split into BookingService, BillingService, NotificationService.
Classes should be open for extension, closed for modification. Add new behaviour without changing existing code.
Interview application: A payment system should accept new payment methods (UPI, card, wallet) via new classes implementing a PaymentStrategy interface — not by adding if/else blocks to existing code.
Subtypes must be substitutable for their base types without breaking the program.
Interview application: If Vehicle has a refuel() method, and ElectricVehicle extends Vehicle, then ElectricVehicle shouldn't inherit refuel(). Use interfaces (Refuelable, Rechargeable) instead of a rigid inheritance hierarchy.
Clients shouldn't be forced to depend on interfaces they don't use. Prefer many small interfaces over one large one.
Interview application: Instead of one Animal interface with fly(), swim(), run() — split into Flyable, Swimmable, Runnable. A Dog implements Swimmable and Runnable but not Flyable.
High-level modules shouldn't depend on low-level modules. Both should depend on abstractions (interfaces).
Interview application: OrderService shouldn't directly instantiate MySQLDatabase. It should depend on a Database interface — allowing you to swap MySQL for PostgreSQL or a mock in tests without changing OrderService.
PaymentProcessor." That signal alone puts you in the top 20% of candidates.
3. Eight Design Patterns Every Indian SWE Must Know for LLD
You don't need to know all 23 GoF patterns. You need to know these 8 deeply — when to use them, when NOT to use them, and how to implement them quickly.
1. Strategy Pattern
Use when: You have multiple interchangeable algorithms or behaviorsClassic examples: Payment methods (UPI, card, wallet, net banking), sorting strategies, discount calculation, delivery routing. Define a PaymentStrategy interface with a pay(amount) method. Each payment type is a class implementing it. The context (cart) holds a reference to the strategy and calls it — without knowing which one.
2. Observer Pattern
Use when: One object's state change needs to notify multiple other objectsClassic examples: Order status notifications (SMS, email, push), stock price alerts, UI event handling. Subject maintains a list of Observers. When state changes, calls notifyAll(). Each observer implements update(). New notification channels (WhatsApp) = new observer class, zero changes to the Subject.
3. Factory / Factory Method Pattern
Use when: Object creation logic is complex or type depends on runtime inputClassic examples: Vehicle creation (car, bike, truck), notification creation (email, SMS, push), payment gateway selection. A VehicleFactory.create(type) returns the right Vehicle subclass. The caller never uses new directly — this centralises creation logic and makes adding new types easy.
4. Singleton Pattern
Use when: Exactly one instance must exist (global state, shared resources)Classic examples: Database connection pool, configuration manager, logging service, cache manager. Private constructor + static getInstance() method. In multi-threaded environments, use double-checked locking or enum-based Singleton. Warning: Overusing Singleton is an anti-pattern — interviewers will notice.
5. Decorator Pattern
Use when: You want to add functionality to objects without modifying their classClassic examples: Pizza/burger toppings, feature flags on UI components, logging/auth wrappers around services. A CoffeeDecorator wraps a Coffee and overrides getCost() and getDescription() — adding functionality while delegating the base behaviour. Avoids the subclass explosion of inheritance.
6. Builder Pattern
Use when: An object has many optional parameters or complex construction stepsClassic examples: HTTP request building, SQL query construction, complex form objects, Pizza with optional toppings/size/crust. Builder separates construction from representation. Eliminates telescoping constructors. Enables readable new Pizza.Builder().size(LARGE).crust(THIN).addTopping(CHEESE).build().
7. Command Pattern
Use when: You need to queue, undo, or log operations as objectsClassic examples: Text editor undo/redo, task queue, transaction rollback, smart home commands. Each action is encapsulated as a Command object with execute() and undo(). A queue stores commands for deferred execution or replay. The invoker doesn't know the specifics of each command.
8. Template Method Pattern
Use when: Multiple classes share an algorithm skeleton but differ in specific stepsClassic examples: Data parsing (CSV vs JSON vs XML), game turn flow (setup → play → end), report generation. Abstract base class defines the skeleton (final method). Subclasses override only the specific steps. Avoids code duplication while allowing customisation of individual steps.
4. The 45-Minute Machine Coding Framework
Most engineers dive straight into code. That's the mistake. Here's the exact time allocation that separates passing candidates from failing ones:
5. Ten Classic LLD Problems with Full Solutions
These 10 problems account for the vast majority of LLD interview questions at Indian companies. Master these and you'll handle any variation thrown at you.
Core entities: ParkingLot, ParkingFloor, ParkingSpot (compact/large/motorcycle), Vehicle (Car/Truck/Motorcycle), Ticket, PricingStrategy, EntryPanel, ExitPanel.
Key design decisions:
- Use Strategy pattern for pricing (hourly, flat, weekend pricing)
- Use Factory pattern to create Vehicle objects from type string
- ParkingSpot has a
VehicleTypeenum — spots are compatible only with certain vehicle types - ParkingLot is a Singleton — only one instance exists
- Use Observer to update availability display when spots change
Core entities: Customer, Restaurant, MenuItem, Cart, Order, DeliveryAgent, OrderStatus, Payment, Notification, Location.
Key design decisions:
- State pattern for Order lifecycle: PLACED → CONFIRMED → PREPARING → PICKED_UP → DELIVERED → CANCELLED
- Observer pattern for notifications when order state changes (SMS, push, email)
- Strategy pattern for delivery agent assignment (nearest, load-balanced, rated)
- Strategy pattern for payment methods
- Cart uses Composite pattern — CartItem wraps MenuItem with quantity
Core entities: Rider, Driver, Trip, Location, Vehicle, FareCalculator, MatchingStrategy, TripStatus, Payment, Rating.
Key design decisions:
- Strategy pattern for driver matching (nearest, surge pricing zones, vehicle type)
- Strategy pattern for fare calculation (base fare, surge multiplier, distance-based)
- State pattern for trip lifecycle: REQUESTED → DRIVER_ASSIGNED → IN_PROGRESS → COMPLETED
- Observer for real-time location updates and notifications
- Rating system as a separate bounded context — avoid polluting Driver class
Core entities: Library, Book, BookItem (physical copy), Member, Librarian, Catalogue, Reservation, Fine, Notification.
Key design decisions:
- Distinguish
Book(metadata: ISBN, title, author) fromBookItem(physical copy with barcode and availability) - Fine calculation uses Strategy pattern (per-day, flat, waived for premium members)
- Reservation uses a queue — implement with linked list or priority queue
- Observer: when BookItem returned → notify members in reservation queue
Core entities: ATM, ATMState, Card, Account, CashDispenser, Keypad, Screen, Printer, BankService.
Key design decisions:
- State pattern is the core of this problem: IdleState → HasCardState → AuthenticatedState → SelectingTransactionState → TransactionState
- Each state implements:
insertCard(),enterPin(),selectTransaction(),dispatchCash(),ejectCard() - CashDispenser uses Chain of Responsibility for dispensing denominations (₹2000 → ₹500 → ₹200 → ₹100)
Core entities: Movie, Theatre, Screen, Show, Seat, SeatLock, Booking, Payment, User, Notification.
Key design decisions:
- Concurrency is the key challenge: two users trying to book the same seat simultaneously. Use seat locking with a timeout (optimistic locking or distributed lock)
- SeatLock:
lock(seatId, userId, expiryTime)— held for 5 minutes during payment - Seat status: AVAILABLE → LOCKED → BOOKED
- Strategy pattern for pricing (peak hours, day/night, seat tier: gold/silver/platinum)
Core entities: User, Group, Expense, Split (EqualSplit, PercentSplit, ExactSplit), Balance, Transaction, Notification.
Key design decisions:
- Strategy pattern for expense splitting: EqualSplit, PercentSplit, ExactSplit all implement
Splitinterface - Balance tracking: maintain a
Map<User, Map<User, Double>>— who owes whom how much - Simplify debt algorithm: reduce the number of transactions needed to settle all debts (greedy approach)
- Observer for payment reminders and settlement notifications
Core entities: Board, Cell, Piece (King, Queen, Rook, Bishop, Knight, Pawn), Player, Move, Game, MoveValidator.
Key design decisions:
- Each Piece subclass implements
getValidMoves(Board board, Cell from)— polymorphism at its purest - Board is an 8×8 grid of Cells; each Cell optionally holds a Piece
- Move validation is separate from Piece movement — use Chain of Responsibility for validators (bounds check → own piece check → path clear check → check detection)
- Game state uses a move history stack enabling undo
Core entities: ElevatorSystem, Elevator, ElevatorState, Request (ExternalRequest, InternalRequest), Dispatcher, Direction, Floor.
Key design decisions:
- State pattern: Idle → Moving (Up/Down) → DoorsOpen
- Strategy pattern for dispatching: FCFS, SCAN (elevator algorithm), LOOK
- SCAN algorithm: serve requests in current direction until no more, then reverse — this is the standard "elevator algorithm"
- Each elevator maintains two queues: upRequests and downRequests (TreeSets for ordered processing)
Core entities: Hotel, Room, RoomType, Booking, Guest, Payment, RoomSearchCriteria, PricingStrategy, Amenity, Review.
Key design decisions:
- Strategy pattern for pricing (seasonal, weekend, early bird, last-minute)
- Room availability uses date-range intersection queries — use interval trees or sorted sets
- Booking state: PENDING → CONFIRMED → CHECKED_IN → CHECKED_OUT → CANCELLED
- Cancellation policy as a separate Strategy (full refund, partial refund, no refund based on timing)
6. Company-Specific LLD Expectations
| Company | LLD Round Format | What They Look For | Typical Problem |
|---|---|---|---|
| Razorpay | 90-min machine coding, any language | Clean abstractions, extensibility, production-quality code | Payment system, ATM, Splitwise |
| Flipkart | 90-min machine coding (Java preferred) | SOLID compliance, design patterns, testability | E-commerce cart, search filter, Parking Lot |
| Swiggy | 60-min coding + 30-min design discussion | Working code first, then discuss extensibility | Food delivery, restaurant menu, delivery tracking |
| CRED | 45-min design + coding | Minimal but correct design, code quality | Credit card bill reminder, reward system, Splitwise |
| PhonePe | 60-min machine coding | Payment domain understanding, concurrency awareness | Payment processor, wallet system, ATM |
| Meesho | 45-min coding | Working solution, clean interfaces | Catalogue management, order tracking, inventory |
| Groww | 60-min design + code | Financial domain awareness, state management | Portfolio tracker, SIP calculator, transaction log |
7. Seven LLD Interview Mistakes That Get Candidates Rejected
if (vehicleType == "CAR") ... else if (vehicleType == "TRUCK") ... is a red flag. This violates OCP. Use inheritance or Strategy pattern. Interviewers look for this specifically.
8. Four-Week LLD Preparation Plan
| Week | Focus | Tasks |
|---|---|---|
| Week 1 | SOLID + Core Patterns | Study all 5 SOLID principles with code examples. Implement Strategy, Factory, Singleton, Observer, and Decorator from scratch in your preferred language. |
| Week 2 | First 5 Problems | Solve Parking Lot, Library Management, ATM, Hotel Booking, and Elevator in 60–90 minutes each. Write actual code, not pseudocode. Review solutions for SOLID compliance. |
| Week 3 | Next 5 Problems + Timed Practice | Solve Food Delivery, Ride-Hailing, Chess, Splitwise, BookMyShow under strict 45-minute timers. This is the most important week — simulate real interview conditions. |
| Week 4 | Mock Interviews + Review | Do 3–4 mock LLD interviews with a peer or mentor. Review code quality, pattern usage, and how well you narrate. Target: finish core class structure in 20 minutes, implementation in 40. |
9. FAQ: LLD Interviews in India
Do freshers face LLD interviews?
Generally, no. LLD rounds are more common for engineers with 2+ years of experience. Freshers are typically tested on DSA and basic OOP concepts. However, if you're applying to product companies directly from college, basic OOP design (class relationships, inheritance vs composition) can come up in coding interviews.
Should I use Java or Python for machine coding rounds?
Java is preferred at most Indian product companies for LLD because the type system makes design decisions explicit (interfaces, abstract classes, enums). Python is accepted at most companies but can look loose — you'll need to use type hints and ABCs to signal design intent. Use whichever language you're fastest in, but be deeply comfortable with OOP constructs in that language.
How much time should I spend drawing a class diagram vs. coding?
In a 45-minute round: 5 minutes clarifying, 10 minutes designing (on paper or whiteboard), 25 minutes coding, 5 minutes reviewing. Many candidates spend too long designing and run out of coding time. The interviewer needs to see working code, not just a perfect diagram.
What if I don't finish the implementation in time?
It's normal not to finish everything. What matters is: the core structure is correct, the most important classes are implemented, and you can articulate what you'd build next and why. Say "I'd implement the payment flow next — it would use the same PaymentStrategy interface I defined here, with UPI and card as concrete implementations." That answer scores better than rushing to finish with messy code.
Is LLD tested differently at Google compared to Indian companies?
Google doesn't have a formal LLD round as a standalone. Instead, clean OOP design is evaluated in coding rounds through code quality expectations. Google expects readable, well-structured code — they'll notice if you write monolithic functions. Indian companies have explicit, standalone LLD/machine coding rounds which are a different format.
Pranjal spent 6+ years at Microsoft India and has coached 1,572+ engineers through FAANG and top Indian product company interviews. He founded Prepflix to give engineers from service company backgrounds the same structured preparation advantage that IIT graduates typically get from their networks.