How to approach Low Level Design Interviews
Practical guidance for preparing confidently, structuring your answers, and making every minute count in technical interviews.
Let's answer a few basic questions first:
Q. Will I have to write code or will UML diagrams be enough?
ANS: Yes, you have to write code or discuss logic for a few functionalities. Only drawing UML diagrams or writing names of classes won't be enough.
Q. I don't have much time. Tell me which are the most important design patterns I should study first?
ANS: Factory, Strategy, Observer, and Singleton.
Q. But how can I explain such large systems in a 45-minute interview? I always run out of time.
ANS: A vast majority of candidates fail because they are not able to present their solution properly in a limited time frame. Watch this YouTube video where I have explained how to take care of this problem: YouTube - present your solution in limited time
Q. Are questions like LRU cache and Search Autocomplete system also asked in LLD rounds?
ANS: Yes. Depending on the interviewer, you can either get a pure LLD question like designing a parking lot or food ordering system, or you can get a DSA-based design question like the examples above. I know you hate this extra prep, but that's what it is. Companies ask these questions, so you need to prepare for both types. The silver lining is that you already prepared for DSA-based design questions while preparing for DS & Algo rounds.
PS: You can practice company-wise Low Level Design rounds and AI Coding round interview questions on CodeZym.
Let's get started.
In my view, you should first master DS & Algo and only after that you should start your LLD preparation. Once you have mastered DS & Algo, low level design questions are easier to practice.
Low Level Design Interview Formats
There are two types of low level design interview formats:
-
75 to 90 minutes of machine coding: You will be given requirements and method signatures, and you have to write code in an editor. In the last 10-15 minutes, you may have to explain your code to the interviewer.
-
45-60 minutes of face-to-face discussion: This is the most common format. You have to come up with requirements yourself, then discuss class structure and implementation details.
What Interviewers Look For
In any object-oriented design interview, your interviewer is typically looking for three things:
1. How you list requirements, especially core features
For example, if your problem statement is "Design a Parking Lot", then your core features will be:
park()
unpark()
If your problem statement is "Design a restaurant food order and rating system like Zomato, Swiggy, Uber Eats, etc.", then your core features will be:
orderFood()
rateOrder()
displayRestaurantsByRatingOrPopularity()
Sticking to only the most important features and leaving the rest out is important. If you list unimportant features in the requirements section, then you will waste time discussing their implementation and have less time for discussing the important features.
2. How you break your problem statement into multiple classes
I always find it easier to start by listing entities and their corresponding entity managers, if required.
For example, for a restaurant food ordering and rating system, your entities can be Restaurant, Order, FoodItem, etc., and their corresponding managers can be RestaurantsManager, OrdersManager, etc.
3. How you use design patterns to solve the core features
The most common design patterns that you will come across in a low level design interview are Strategy, Factory, Singleton, and Observer. You should be familiar with their implementation and the different use cases where they can be used. We will see some of those use cases in a moment.
4. How you handle multi-threading
A fourth topic is also discussed if you have done well in the above three steps: handling multi-threading.
There will be discussion on the use of locks, synchronization features, and thread-safe data structures for your design to work correctly in a multi-threaded environment.
Commonly Asked LLD Interview Questions
Here are three commonly asked LLD interview questions that cover the top four design patterns you will come across in interviews.
1. Design a Parking Lot with multiple floors
Problem statement: https://codezym.com/question/7
"Design a Parking Lot" is the most common LLD interview question. In the above problem statement, there can be multiple parking strategies, so you should use the Strategy design pattern to solve this question.
- Python tutorial: Python - Parking Lot LLD
- Java tutorial: Java - Parking Lot LLD
- AI Mock Interview Practice: MockGym - Parking Lot
2. Design a game of chess
Problem statement: https://codezym.com/question/8
In Low Level Design of chess, we use the following design patterns:
-
Factory design pattern: Chess Piece Factory to create different chess piece objects like king, queen, pawn, etc.
-
Strategy pattern: To implement different moves, such as straight move, diagonal move, etc.
-
Singleton pattern: To ensure there is a single instance of the chess piece factory object.
-
Python tutorial: Python - Chess LLD
-
Java tutorial: Java - Chess LLD
-
AI Mock Interview Practice: MockGym - Chess
Now three design patterns, namely Strategy, Factory, and Singleton, are covered. Finally, let's cover the Observer design pattern in our third and last question.
3. Design a food ordering and rating system like Zomato, Swiggy, Uber Eats, etc.
Problem statement: https://codezym.com/question/5
In any food ordering and rating system, customers can rate their orders. There are also classes that display lists of top restaurants based on their overall average rating or the average rating of their individual food items.
Whenever any user rates their order, all these classes need to be updated so that they can update both restaurant and corresponding food item ratings, and update their lists.
Observer design pattern will be used here to notify observers, i.e. classes that manage the top restaurants list, about changes in the common data set they need to observe. In this case, that data set is the rating of different orders.
- Python tutorial: Python - Food ordering & ratings LLD
- Java tutorial: Java - Food ordering & ratings LLD
- AI Mock Interview Practice: MockGym - Food ordering
This was all I had to share for now. Thanks for reading. Wish you the best of luck with your preparation.