Software engineering
Below is a list of 59 confirmed system design interview questions that were asked at Google, Amazon, Facebook, or Microsoft.
We identified these questions by analyzing a dataset of over 300 Glassdoor interview reports that were posted by software engineers, engineering managers, and technical program managers.
And the first thing you'll want to know is which of these questions are the most common.
Let’s get started.
The 11 questions below were the most common out of over 350 system design interview questions that we collected, and they're listed roughly in order of frequency below (note: we've just made minor edits to the phrasing).
Let's dig into these:
For this question you'll typically be asked to design a specific app, such as Twitter, Instagram, etc. For this example, we’ll assume the interviewer asked you to design Twitter. Here are some considerations for answering this question:
Ask clarifying questions
Is the interviewer looking for a design of the core features, or a high-level overview of the whole service?
What are the constraints of the system?
What are your assumptions? (traffic distribution, number of active users and tweets, read vs write-heavy)
Design high-level
Back-of-the-envelope calculations: average KBs per tweet, size of new tweet content per month, read requests and tweets per second, etc.
High-level components: write, read, and search APIs; types of databases; SQL vs NoSQL; etc
Drill down on your design
Potential bottlenecks: adding a load balancer with multiple web servers, scalability issues, fanout service slowing down tweets and @replies, etc.
Components that you could dive into: how a user views the home timeline or posts a tweet, the intricacies of the database design, etc.
Bring it all together
Consider: does the final design address the bottlenecks you’ve identified? Does it meet the goals you discussed at the beginning of the interview? Do you have any questions for the interviewer?
For a full answer to this question, take a look at the video guide below from Success In Tech or this text guide from donnemartin on GitHub.
Another topic that comes up frequently is designing a classic game. The exact game you’ll be asked about varies, but here are some of the most common ones we’ve seen:
Tic-tac-toe
Chess
Boggle
Minesweeper
Cards/poker
Let’s walk through an example of how you could approach the problem if you were asked to design a chess game.
Ask clarifying questions
What are the rules of the game?
How many players are there? Are there spectators?
Do we need a timer? Are any other special functions required?
Design high-level
Possible classes for the game: board, piece, spot, etc.
Methods that will be required for things like moving pieces
Drill down on your design
Identify important attributes for each class, such as the grid coordinates and color of each spot
Define how the game will prevent illegal moves and recognize a victory
Bring it all together
Sense check your design, and confirm whether it has met all of the requirements you identified at the beginning of the interview
Some of the above considerations were inspired by this in-depth solution to the question, so feel free to check out that resource.
For questions like these, interviewers are testing your skills in object-oriented design, to see whether you can apply technical thinking to physical objects.
Ask clarifying questions
Is this a multiple floor parking garage or a single level parking lot?
How many entry and exit points will be needed, and for what types of vehicles?
Are there monetary goals for this parking lot?
Design high-level
Possible use cases: customers parking and paying for their spot, admin managing the system, parking attendants maintaining the lot and helping customers, etc.
Possible classes of the system: ParkingLot, ParkingFloor, Account, ParkingTicket, Vehicle, etc.
Drill down on your design
How will you diagram specific activities? (e.g. customers paying for parking tickets, display panels showing available spots, etc.)
What are the required enums, data types, and constants of the eventual code for the parking lot system?
Bring it all together
Will this system meet the requirements you’ve laid out with the interviewer in the beginning of the session?
For a full answer to this question, take a look at this text guide from Educative.io. You may also find this video walk-through from Think Software useful:
URL shortening services like TinyURL, Bitly, etc. provide short link aliases that redirect to longer URLs. Here are some points of consideration to help you work out how to build this kind of system.
Ask clarifying questions
Will users be able to customize the URL?
How long do the URLs last before they expire?
What are the availability and latency requirements for this system?
Design high-level
Back-of-the-envelope calculations: estimate the traffic and storage needs per month, as well as bandwidth and memory requirements
Define the APIs (SOAP, REST, etc) as well as a general database schema (URL mappings and user data)
Drill down on your design
Consider tradeoffs: encoding actual URLs may turn out the same shortened URL for two different users who enter the same URL. System may not work for URLs with URL-encoding. Concurrency may cause problems, etc.
Where will you place load balancers, and how will you cache URLs?
Bring it all together
Is the system you’ve designed highly available, so that URLs will not break if the servers go down? Does it meet any potential business objectives laid out at the start of the interview?
For a full answer to this question, take a look at this text guide from Educative.io.
Are you getting invited to enough system design interviews? If not, you might want to use our free tech resume guide (with examples) to improve your resume.
A distributed web cache is key to many systems, so that the RAM of multiple machines can be accessed in a single in-memory store quickly and reliably. Let’s look at some general points that should help you build out a design.
Ask clarifying questions
Consider the functional and non-functional requirements: put (storing objects under a unique key), get (retrieving objects), scalability, availability, performance, etc.
Specify your assumptions: can we assume that put and get are strings?
Design high-level
Possible data structures for storing data: hash table, queues, doubly linked list
Consider different options to distribute the cache, as well as the benefits of each (e.g. dedicated cache clusters vs co-located caches)
Drill down on your design
Identify the tradeoffs of your choices: Maximum hash table size will prevent from adding more elements, shards may become “hot” (aka process more requests than others), etc.
Data replication could help with “hot” shard bottleneck
Bring it all together
Is the system you’ve designed fast, highly scalable, and available?
For a full answer to this question, take a look at the video guide below from System Design Interview.
If you’ve ever started typing something into a search engine, then you will have seen the suggested “autocomplete” options that are provided. This is also an interesting, and common, system design interview topic. Here are some points you could consider here:
Ask clarifying questions
What are the key features? (fast response time, high relevance, number of results, etc.)
What are the functional and non-functional requirements?
Design high-level
What data structure will you use to find suffixes and word completion, and how will you sort the solutions?
How will you store this data structure and connect it with the rest of the system? (Redis cache, database, hash table, API server, load balancer, etc.)
Drill down on your design
How would you modify the frequency of the system without compromising availability or increasing latency?
Consider the fault tolerance of the system - How would you store the already built trie data structure so that in case of failure the system can be restored?
Bring it all together
Is there any more optimization that you could do? Does the system meet the requirements laid out in the beginning of the interview?
For a full answer to this question, take a look at the video guide below from Narendra L.
APIs are kind of like the bridges that connect the roads of major software products. As a result, they are a central part of the system design of major apps like Instagram, YouTube, Twitter, etc.
Let’s say you were asked, very broadly, to design an API for a website. Here are some examples of how you could go about this:
Ask clarifying questions
Who/what will be using the API?
What is the purpose of the API?
What kind of information does the API need to pass?
Design high-level
Define how the API will be accessed by users (e.g. through a mobile app, website, etc.)
Consider the provider side of the API and the services/databases that will be accessible
Drill down on your design
Should an API gateway be used to improve security?
Will there be an authentication process to access the API?
Will you use a REST API or something different?
Bring it all together
Does your API meet all of the original requirements? Are there any additional considerations, or areas that could use further refinement?
To learn more about API design, check out this mock interview from Exponent, on designing the Twitter API:
Real-time messaging apps are a common standalone product, or a built-in feature of larger systems. For this question, you might be asked to design a specific app, like WhatsApp or Facebook Messenger.
Ask clarifying questions
What is the scale and profile of the user base?
What features should be incorporated into the messenger? (e.g. text, video, audio, read receipts, message encryption, etc.)
Should we focus on monetizing the system?
Design high-level
How many servers will this system need, and how will clients connect to them?
How will the senders and receivers of messages connect to the servers and database?
Where will the messages be stored, and for how long?
Drill down on your design
How will you scale the system, and where are the bottlenecks?
Deep dive into a component: sent, delivered, read notifications; push notifications; media sharing; database design; etc.
Bring it all together
Have you met the initial goals you and the interviewer laid out for the system?
To see another example of how to answer this question, watch this ex-Google engineering manager answer "Design Telegram":
If you were interviewing at Google this question would probably be presented as "Design Google Drive" whereas elsewhere it might be "Design Dropbox."
You'll need to design a system that can scale to millions of users and handle petabytes of data.
Ask clarifying questions
Design high-level
Drill down on your design
Bring it all together
For a full answer to this question, take a look at the video guide below by Naren from Tech Dummies.
This question might take the form of "Design Amazon", "Design eBay", "Design FlipKart", etc.
Your online shopping system will need to store an inventory of products with lots of categories, allowing customers to search through them and make purchases. You'll also need to think about how you handle the expanding load on the website and prevent it from crashing on key retail days.
Ask clarifying questions
Design high-level
Drill down on your design
Bring it all together
To see an expert answer to the question, watch the video below - Gaurav Sen is the candidate and he's always great.
If you'd prefer to take a look at a written solution to the problem, check out this article on Medium.
This question frequently appears as "Design Uber", "Design DoorDash", etc., substituting in whichever brand is prominent in the region you're interviewing in.
Let's take a look at an answer outline to "Design Uber".
Ask clarifying questions
Design high-level
Drill down on your design
Bring it all together
See a detailed written answer for "Design Uber back-end" in this Educative blog post.
Now that we’ve gone through the most common system design interview questions, let’s get into a longer list of questions that have been asked in real tech interviews, according to data from Glassdoor (note: we've edited to improve the phrasing of some questions).
The questions below are organized by company, to help you find the most relevant ones for your interviews.
How would you design Instagram / Facebook / Twitter?
Design a live commenting system for posts
Design WhatsApp / Facebook Messenger
Design Facebook status search
Design an online collaborative editing tool
How would you design an autocomplete service for a search engine?
Design a travel booking system for Facebook users
Design Instagram Stories
Design a system to prevent ads from foreign actors from interfering in domestic politics
Design a distributed botnet
Design a video upload and sharing app
Design the API layer for Facebook chat
How would you use a load balancer for memcache servers?
How would you architect the Facebook newsfeed?
Implement a typeahead feature
How would you design Twitter / Instagram / Facebook?
Design Snake / Chess / Tic-Tac-Toe / Poker / Boggle
Design a parking lot
Design a phone billing system
Design a TinyURL service
Design an API that would take and organize order events from a web store
Design an elevator
Design a file system
Design a product recommendation system based on a user's purchase history
How would you design an electronic voting system?
Design a deck of cards
Design a system to optimally fill a truck
Design a warehouse system for Amazon
Design an online poker game
Design a parking payment system
Design a system to interview candidates
Design a search engine autocomplete
Design an airport
Design the Prime Video home page
Design a registration system for a restaurant
Design a food delivery app at a global scale
Design a Dropbox service
Design an inventory system
Design a news website
Design a shopping cart system
Design a system to find friends on social media
Design a Swiggy delivery system with a focus on optimizing for the shortest route
Design a temperature identification system with geographically distributed sensors
Design a ticketing system
How would you design a system that reads book reviews from other sources and displays them on your online bookstore?
Design a promotion mechanism which could give 10% cash back on a particular credit card
How would you build software behind an Amazon pick up location with lockers?
Design a distributed cache system
How does buffer overflow work?
How would you design an online portal to sell products?
Design a new fitness wearable to measure heart rate
Design a shopping cart
As you can see from the complex questions above, there is a lot of ground to cover when it comes to system design interview preparation. So it’s best to take a systematic approach to make the most of your practice time.
Below, you’ll find three preparation steps with links to free resources. You can also refer to our system design interview prep guide and our list of 19 system design interview tips from ex-interviewers.
Otherwise, let's start with preparation step 1.
There is a base level of knowledge required to be able to speak intelligently about system design. You don't need to know EVERYTHING about sharding, load balancing, queues, etc.
However, you will need to understand the high-level function of typical system components. You'll also want to know how these components relate to each other, and any relevant industry standards or major tradeoffs.
To help you get the foundational knowledge you need, we've put together a series of 9 system design concept guides. Here's the full list:
Network protocols and proxies
, which make it possible for any networked computers to talk to each other, no matter where they are or what hardware or software they’re running.
Databases
, integral components of the world’s biggest technology systems.
Latency, throughput, and availability
, three common metrics for measuring system performance.
Load balancing
, the process of distributing tasks over a set of computing nodes to improve the performance and reliability of the system.
Leader election algorithms
, which describe how a cluster of nodes without a leader can communicate with each other to choose exactly one of themselves to become the leader.
Caching
, a technique that stores copies of frequently used application data in a layer of smaller, faster memory in order to compute costs and to improve data retrieval times and throughput.
Sharding
, the horizontal scaling of a database system that is accomplished by breaking the database up into smaller “shards,” which are separate database servers that all contain a subset of the overall dataset.
Polling, SSE, and WebSockets
, techniques for streaming high volumes of data to or from a server.
We’d encourage you to begin by studying these topics, and once you understand the basics, you can begin practicing system design questions.
As you likely noticed in the common questions section, we recommend using a repeatable answer framework when answering system design interview questions. You can learn more about that framework here, but in the meantime, here is a summary:
First, spend about five minutes checking in with your interviewer about the functional and non-functional requirements of what you’re going to design. Ask about the system’s goals and how they will be measured. Be sure that you fully understand the question before moving forward.
Call out any assumptions you’re making that will influence your design approach. If applicable, ask about non-functional requirements such as availability, consistency, scalability, etc.
Start the high-level design by specifying one to two metrics (e.g. number of users added, products sold before vs after a feature launch, etc.). Then use these metrics to do some simple calculations in order to find the optimal usage pool of the system.
Once you’ve defined your metrics, map out only the most functional components of the system (e.g. front end, web server, database, etc.).
Finally, before getting into the more detailed aspects of your system, make some decisions on how you will design its database. Choose whether it will be a relational or a no-SQL database, as well as its metadata and table structure.
If you haven’t already, start mapping out the system on your whiteboard. Talk through your diagram so that your interviewer is able to follow along and ask questions when necessary.
Consider any bottlenecks that may arise when it comes to the system’s scalability, performance, or flexibility.
To finalize your design, play to your strengths by choosing a component you’re more familiar with and drilling down on it. If you’re not sure which component would be best to explore, ask your interviewer.
Before wrapping up the round, take about five minutes to re-examine what you’ve designed. Does it meet the objectives you laid out with the interviewer at the beginning of the session? It is okay to change some components at this stage if you think it will improve the system, but you must explain to the interviewer what you are doing and why.
Apply this framework to practice questions like those we’ve included in this article. Use it on different types of questions in a variety of subjects, so that you learn how to adapt it to different situations and respond to unpredictable questions on the fly.
The first step is always to practice by yourself, as we touched on above. Once you’ve got the framework down, start interviewing yourself out loud as you practice. Play both the role of the interviewer and the candidate, asking and answering questions. This will help you develop your communication skills and your process for breaking down problems.
Once you've done some individual practice, we would also strongly recommend that you practice solving system design questions with someone else interviewing you.
A great place to start is to practice with friends or family if you can. This can help you get some preliminary feedback on your approach, which will be especially helpful if your partner is familiar with system design interviews.
Finally, you should also try to practice system design mock interviews with expert ex-interviewers, as they’ll be able to give you much more accurate feedback than friends and peers.
If you know someone who has experience running interviews at Google, Meta or another big tech company, then that's fantastic. But for most of us, it's tough to find the right connections to make this happen.
Here's the good news. We've already made the connections for you. We’ve created a coaching service where you can practice system design interviews 1-on-1 with ex-interviewers from leading tech companies. Learn more about how an interview coach can give you an advantage, or simply click here to start scheduling sessions today.
Keep reading:
javinpaul
·
Follow
Published in
Javarevisited
·
12 min read
·
Apr 27, 2020
--
Hello guys, If you have given any coding interview then you know that System design or Software design problems are an important part of programming job interviews, and if you want to do well, you must prepare this topic.
In the past, when I shared my list of programming interview questions, I have shared a couple of System design questions but my readers kept asking me for more questions, as it is a hard topic to master, and more and more practice is needed.
I had my own list of questions that I have collected from various interviews with friends and colleagues but I needed more questions for this article when I stumbled upon the Grokking System Design Interview course on Educative.
It’s like a godsend resource because it not only gives you a lot of System design question but also provide all the knowledge and tools you need to solve those questions.
In other words, this course teaches you step by step how to proceed with designing a real-world system like Facebook, Twitter, Uber, etc.
Also, there are not too many system design interview courses and resources you can look to prepare this topic. When I was searching I only find Grokking The System Design course by Educative and Mastering the System Design Interview course on Udemy by Frank Kane, an Ex Amazon Hiring Manager.
Other than that I didn’t find any online course which is completely focused on solving system design problems from top companies like Amazon, Google, Microsoft, Apple, SalesForce, FlipKart, etc.
When you combine this course with this list of questions you will have the best material to prepare for your System design interview. You can also first try all these questions by yourself before joining the course or looking it my solution for some of the questions.
This works best only if you have some Coding experience and fundamental knowledge of Computer Science and Software Design. If you are a complete beginner in this area then I would suggest you first start with a fundamental course to learn basics like Java Programming: Principles of Software Design on Coursera or the Web Application & Software Architecture 101 on The Educative Team itself.
This course will not only teach you how to solve a real-world problem using Java with multiple classes but also software design which is not just coding but also involves logical thinking and design, which is very important for becoming a successful Software Developer.
Without any further ado, here is the list of some of the most popular System design or Object-oriented analysis and design questions to crack any programming job interview.
1. How do you design the Vending Machine in Java? (solution)
You need to write code to implement a Vending machine that has a bunch of products like chocolates, candy, cold-drink, and accept some coins like Nickle, Dime, Quarter, Cent, etc. Make sure you insert a coin, get a product back, and get your chance back. Also, write the Unit test to demonstrate that these common use cases work. If you get stuck you can read my two-part articles (part1 and part 2) about solving these classical system design questions.
2. How do you design a URL Shortening service like goo.gl or bit.ly? (solution)
This one is another common System design question. You have given a (typically) long URL, how would you design a service that would generate a shorter and unique alias for it? If you are not familiar with URL shortener service have a look at some of the popular ones like goo.gl from Google and bit.ly which is used by Twitter.
Make sure to provide database schema and rationale behind some design decisions like how long you keep the data, how to get stats and analytics etc. If you get stuck, you can follow the solution given on Grokking the System Design Interview course on DesignGuru.io.