System Design Interview Questions
- 0of 0 votes
AnswersDesign an ATM machine system..
- TechPrep December 20, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon System Design - 25of 27 votes
AnswersGiven a large network of computers, each keeping log files of visited urls, find the top ten of the most visited urls.
- chandeepsingh85 September 26, 2013 in United States
(i.e. have many large <string (url) -> int (visits)> maps, calculate implicitly <string (url) -> int (sum of visits among all distributed maps), and get the top ten in the combined map)
The result list must be exact, and the maps are too large to transmit over the network (especially sending all of them to a central server or using MapReduce directly, is not allowed)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - 3of 5 votes
AnswersI was asked to design a meeting scheduler, just like in the Microsoft outlook calendar or the gmail calendar. I proposed that I will create an array of 48 for each day. Every 30 min representing the array entry.
- Bevan March 01, 2013 in United States for AWS
I have to make sure that the next appointment does not collide with a previous meeting.
My solution works fine but it wastes too much memory.
Can anyone please tell me how do I find a better solution to detect collision for meetings.
I don't know all the meetings at the beginning. They will be added randomly later.
Thanks,| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 1of 1 vote
AnswersWe've 1 book left in the inventory. and two people are trying to get the same book ( say person x and person y ). Person x has added book to the cart and about to make payment and person y has also added book to the cart. How would you solve this concurrency problem ?
- the-awakened-1 April 22, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon System Design - 5of 5 votes
Answersdesign a system to return an unique ID for each request. For most of requests, the ID value should increase as time goes, the system should handle 1000 requests per second at least.
- codingfunnyguy December 04, 2013 in United States
timestamps alone is not valid since there might be multiple requests with same timestamps.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - 0of 0 votes
AnswersLet's say you have a simple function (fibonacci/factorial) that you need to run constantly. The largest number that you will receive as input will be 1,000. How can you improve the performance of this function call?
- Sydney March 02, 2012 in United States
I said not use recursion and cache the results using a data structure (i.e. a Map)
What else could you do to improve the performance?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 2of 2 votes
AnswersAlgorithm: You have 50,000 html files, some of which contain phone numbers. How would you create a list of all the files which contain phone numbers?
- Gayle L McDowell April 04, 2005| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design Algorithm - 1of 3 votes
AnswersHow would you synchronize a linked list across multiple computers. If nodes are added/removed to a linked list on one computer, all others must reflect this change. Concurrancy must be accounted for. (java)
- Guy January 22, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - -3of 5 votes
AnswersHow does trie handle scalability as opposed to hashtable? Assuming it is used for a dictionary. Sclability here should cover large size of input, running out of memory, or even running out of memory on multiple machines if distributed system is used.
- Guy February 06, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - 4of 4 votes
AnswersThis question was asked in the Technical Design round.
- varun.venu September 22, 2015 in United States
How would you design a system to provide the top trending topcis in the last 5m/1hour/24hours
The most trending topic should appear first
A topic is said to be trending if it is shared the most. We are talking about a typical multi user environment (something like twitter, facebook).| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer System Design - 0of 0 votes
AnswersHow do you make sure an API does not leak memory?
- Romonov March 19, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - 1of 1 vote
AnswersHow would you optimize an elevator system for a building with 50 floors and 4 elevators ? Optimize in terms of lowest wait times for the users. Nothing related to power consumption.
- tbag March 08, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 2 votes
AnswersWrite a class that displays average of stock prices for a given stock symbol for the last 10 minutes. We have a service that sends stock updates about 5000 times per second. The structure of the message is :
- budsiya March 21, 2014 in United StatesMessage { long timestamp; String symbol; // E.g. AAPL double price; }
| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Large Scale Computing System Design - 0of 2 votes
AnswersDesign a Logging mechanism. Should be thread safe.
- R@M3$H.N January 07, 2014 in India
Initially i came up with Command Pattern, and write into a File. Was asked how i will synchronize multiple threads writing into Same File?
Later he gave hint about Aspect-oriented Programming(AOP). And also he gave a hint of Not always writing into the File, can also be a Mail,etc..| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Data Structures Problem Solving System Design Threads Unix - 4of 4 votes
AnswersDescribe the actions performed by two functions:
- asafiniu February 27, 2013 in United States
Publish(user, msg) - publishes a new post on behalf of 'user'
GetNewsFeed(user) - gathers 30 posts from 'user's friends to show on his/her news feed.
I was asked to map out the relations required for holding large amounts of data.
As a followup, I had to calculate the number of machines facebook would have to initially buy to start off using this news feed.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer System Design - 0of 0 votes
AnswersGiven lat long of cabs in a city(lat long keeps changing)
- ANONU June 11, 2018 in United States
Implement a function getNearby(lat1,long1) which returns all cabs in a circle of radius R from lat1,long1.
Which datastructure will u use?
FollowUp qs: Hows it implemented using a database like MySQl or Postgres.| Report Duplicate | Flag | PURGE
Uber Backend Developer System Design - 5of 9 votes
AnswersWrite a Program for Dictionary which has functionality of lookup and insert . This program should be able to add words on the fly
- Guy February 05, 2014 in United States
I wrote simple code using HashTable
follow up
1) Now we are getting too many words what happens
me: Hashtable will dynamically resize resulting into performance hit . Also they might get hashed to same location as well as we might run out of main memory
2) Okay you are out of main memory , How will you scale this program
me: I will create buckets of HashTable lets say 26 buckets for one for each alphabet and would put them on different machines
3) Lets say you are out of memory on those machines too
me: Okay I need to put them on secondary storage . Here we can have fileSystem or Database . I chose database . I will create simple DB schema of BucketNumber and word .
I will use buckets on main memory as cache , if we are not able to find a word in the bucket then query databse with bucket number and words then remove the least number times looked up word (every time we lookup a word we increament the count i.e value in key,value pair on hashtable) from that bucket and add this word .
I mentioned that bottleneck in this case will be every time a word is not present we need to query DB which usually has high latency which will result into performance hit
4) Lets say we are okay with latency but what if we are getting inserting words between that are only between only in two buckets ex. words starting from a and b only.
Now that I think about it, is it better to do this in a trie? What do you guys think?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 1of 1 vote
AnswersDesign a realtime service that tells users which of their friends are currently online.
Your service must implement two functions:// Return a list of friends of `user_id` that are online List<user_id> getOnlineFriends(user_id) // Tell the service that `user_id` is online setOnline(user_id)
You may assume that you have access to the function `getFriendIds(user_id)` which returns you a list of all friend ids for a given user id
- trunks7j February 15, 2013 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer System Design - 0of 0 votes
AnswersHow do you design a system for very large graphs(does not fit in a single machine)?
- Matt Chad January 31, 2016 in United States| Report Duplicate | Flag | PURGE
Google System Design - 0of 2 votes
AnswersDesign a system like friend's functionality in facebook. should have all features of facebook's friends functionality. like for each person , he can have any number of friends , he will get suggestions for new firends , showing common friends if we visits any other profile . algo should be scalable , robust .
- gopi.komanduri August 02, 2014 in United States| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm Android Application / UI Design Arrays Bit Manipulation C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Database Distributed Computing Dynamic Programming Hash Table Java Large Scale Computing Linked Lists Math & Computation Object Oriented Design Problem Solving Sorting SQL Stacks System Design Trees and Graphs XML - -1of 3 votes
AnswersHow would you design a social network and find or keep track of someone's oldest friend in a social network? Oldest friend means the friend that you have added for the longest time period. My solution to the first question is to represent friendship in a graph , storing a list of friends in each User object, and use breadth-first-search to find connection. Not sure about the second question though. My idea is either keep a reference to the oldest friend as a member field, or have a double linked list of users sorted by the start date of friendship.
- Guy January 29, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 0of 0 votes
AnswersDesign a conference room booking system for a company which can have offices in multiple cities, each city can have multiple buildings, each building can have multiple floors, each floor can have multiple rooms. Each room can have features like capacitiy, video conferencing available, etc.
- Vineet March 06, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 2of 2 votes
AnswersHow would you store the relations in a social network like Facebook and implement a feature where one user receives notifications when their friends like the same things as they do?
- tested.candidate July 13, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 0 votes
AnswersDesign a URL system.
- JSDUDE January 16, 2015 in United States
He even wanted to know what kind of algorithm to use, improve the speed, availability etc.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer System Design - -4of 8 votes
AnswersWhat would happen if you have only one server for a web cache (a web browser cache whose key is url and value is the loaded content of the webpage) but huge numbers of clients? And how would you solve it? Assume the cache is implemented with a hashmap and a linkedlist.
- Guy March 06, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - -5of 7 votes
AnswersHow would you split a search query across multiple machines?
- Guy February 10, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - 1of 1 vote
AnswersYou have a bunch of files and folders, Design a playlist which can have any file from any folder and a player that plays it
- sublimedeveloper February 18, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 3of 3 votes
AnswersDesign a Restaurant Reservation system.
- learner January 09, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design System Design - -1of 1 vote
AnswersDesign class PhoneBook. He was interested in data structure and prototypes of different methods.
- HSJ November 02, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design