Low Level Design (LLD) interviews are a standard round at Indian product companies including Flipkart, Swiggy, Meesho, CRED, and Razorpay. Unlike system design (which is high-level and architecture-focused), LLD requires you to design classes, interfaces, and relationships, and write clean, working object-oriented code. This guide covers LLD interview preparation for India in 2026.
What is LLD and how does it differ from system design
LLD fundamentals:
1. What is an LLD (Low Level Design) interview? An LLD interview (also called 'Object-Oriented Design', 'Machine Coding', or 'OOD') asks you to translate a real-world problem into a working object-oriented design. You are expected to: identify entities (classes), define their attributes and methods, model relationships (inheritance, composition, association), apply design patterns and SOLID principles, and write clean, compilable code (usually in Java, Python, or your preferred OOP language). Duration: 60-90 minutes.
2. LLD vs System Design: System Design (High Level Design / HLD): design the overall system architecture (microservices, databases, APIs, caching, queues, load balancers). Focuses on scalability, reliability, and data flow at a service level. LLD (Low Level Design): design the classes and their interactions for one service or component. Focuses on object-oriented design, design patterns, SOLID principles, and code quality at a class level.
3. What interviewers evaluate: - Does the design capture all the requirements (including edge cases)? - Are the class boundaries clean and the responsibilities clear (Single Responsibility Principle)? - Is the design extensible (Open/Closed Principle; adding a new feature should not require changing existing classes)? - Are design patterns applied appropriately (not overused)? - Is the code clean and readable (meaningful names, no unnecessary complexity)? - Does the code handle error cases?
4. Companies that ask LLD: Flipkart (has a dedicated 'Machine Coding' round), Swiggy, Meesho, Zomato, CRED, Razorpay, Juspay, Urban Company, Dunzo, and most Indian product companies at the 3-7 year experience level. FAANG India typically does not have a separate LLD round (they test OOD concepts within the coding round or system design round).
LLD approach: how to structure your design
LLD methodology:
1. Step 1 — Clarify requirements (5-10 minutes): Ask questions to define the scope. Example (parking lot): 'Should the parking lot handle multiple vehicle types? Is there a specific pricing model (flat rate, hourly)? Multiple floors? Handicapped spots? Reservations?' Write down the requirements and the out-of-scope items. Confirm with the interviewer before proceeding.
2. Step 2 — Identify entities (5 minutes): List the main nouns in the problem. These are candidates for classes. Parking lot example: ParkingLot, ParkingFloor, ParkingSpot, Vehicle, Car, Truck, Motorcycle, Ticket, Payment, ParkingAttendant. Filter: are all of these worth modelling as separate classes, or can some be combined?
3. Step 3 — Define relationships (5 minutes): For each pair of entities, determine the relationship: Composition (ParkingLot contains ParkingFloors; a floor cannot exist without the lot), Aggregation (ParkingSpot has a Vehicle; the vehicle can exist independently), Inheritance (Car is a Vehicle; Truck is a Vehicle), Association (Ticket is associated with a ParkingSpot and a Vehicle). Draw a simple UML class diagram if the interviewer allows.
4. Step 4 — Define interfaces and apply design patterns (5 minutes): Identify extension points: what might change? (payment method, pricing strategy, notification method). Apply patterns where appropriate: Strategy (PricingStrategy: HourlyPricing, FlatRatePricing), Factory (VehicleFactory, SpotFactory), Observer (ParkingLotObserver for availability notifications). Do not over-engineer: only add patterns that solve a real extensibility problem.
5. Step 5 — Write the code (30-45 minutes): Start with the most important class. Write method signatures, then implement the critical methods. Prioritise correctness (a simple, working design beats an elaborate, broken one). Handle error cases (what if there are no available spots? What if the ticket is invalid?).
LLD problem: Parking Lot
Parking Lot LLD:
Requirements: multi-floor parking lot; multiple vehicle types (Motorcycle, Car, Truck); pricing by vehicle type and duration; generate a ticket on entry; calculate bill on exit.
```java // Enums enum VehicleType { MOTORCYCLE, CAR, TRUCK } enum SpotType { COMPACT, LARGE, MOTORCYCLE }
// Vehicle hierarchy abstract class Vehicle { private final String licensePlate; private final VehicleType type; // constructor, getters } class Car extends Vehicle { Car(String licensePlate) { super(licensePlate, VehicleType.CAR); } }
// Parking spot class ParkingSpot { private final int spotId; private final SpotType spotType; private Vehicle currentVehicle;
boolean isAvailable() { return currentVehicle == null; } boolean park(Vehicle v) { if (!isAvailable() || !isCompatible(v)) return false; this.currentVehicle = v; return true; } Vehicle vacate() { Vehicle v = this.currentVehicle; this.currentVehicle = null; return v; } // compatibility check based on spot type and vehicle type }
// Ticket class Ticket { private final String ticketId; private final Vehicle vehicle; private final ParkingSpot spot; private final Instant entryTime; // constructor, getters }
// Pricing strategy (Strategy pattern) interface PricingStrategy { double calculate(Duration duration, VehicleType type); } class HourlyPricing implements PricingStrategy { Map<VehicleType, Double> rates = Map.of( VehicleType.MOTORCYCLE, 20.0, VehicleType.CAR, 40.0, VehicleType.TRUCK, 80.0 ); public double calculate(Duration duration, VehicleType type) { long hours = Math.max(1, duration.toHours()); return hours * rates.get(type); } } ```
Practise Low Level Design and machine coding interview questions with HireStepX's AI voice interviewer. Get scored feedback on your class design explanations, OOD principles, and approach to LLD problems. First 2 sessions free.
Practice freeLLD problem: LRU Cache
LRU Cache LLD:
Design an LRU (Least Recently Used) cache that supports get(key) and put(key, value) in O(1) time, with a fixed capacity.
Approach:
- get: return the value if the key exists; mark it as most recently used; return -1 if not found
- put: insert the key-value pair; if the key already exists, update the value and mark as recently used; if the cache is full, evict the least recently used item
Data structure: HashMap (for O(1) lookup by key) + Doubly Linked List (for O(1) insertion and removal at any position; head = most recently used; tail = least recently used).
```java class LRUCache { private final int capacity; private final Map<Integer, DNode> cache = new HashMap<>(); private final DNode head, tail; // sentinel nodes
private static class DNode { int key, val; DNode prev, next; DNode(int key, int val) { this.key = key; this.val = val; } }
LRUCache(int capacity) { this.capacity = capacity; head = new DNode(0, 0); // MRU sentinel tail = new DNode(0, 0); // LRU sentinel head.next = tail; tail.prev = head; }
int get(int key) { if (!cache.containsKey(key)) return -1; DNode node = cache.get(key); moveToHead(node); return node.val; }
void put(int key, int value) { if (cache.containsKey(key)) { DNode node = cache.get(key); node.val = value; moveToHead(node); } else { DNode node = new DNode(key, value); cache.put(key, node); addToHead(node); if (cache.size() > capacity) { DNode lru = removeTail(); cache.remove(lru.key); } } }
private void addToHead(DNode node) { node.next = head.next; node.prev = head; head.next.prev = node; head.next = node; } private void removeNode(DNode node) { node.prev.next = node.next; node.next.prev = node.prev; } private void moveToHead(DNode node) { removeNode(node); addToHead(node); } private DNode removeTail() { DNode node = tail.prev; removeNode(node); return node; } } ```
Frequently asked questions
Explore more