SDE-2 Interview Questions
- 0of 0 votes
AnswersThe number of valid combinations of a strings for given input array a[], where a=>1, z => 26, and 0 <= a[i] <= 9
- nelly2k May 19, 2017 in United States
{1,1,1} => {aaa, ak, ka} => 3
{1,1,0} => {aj} => 1| Report Duplicate | Flag | PURGE
Facebook SDE-2 Algorithm - 0of 0 votes
AnswersProducts are identified by alphanumeric codes. Each code is stored as a string. We have three types of products:high priority, medium priority, and low priority. Given an array of product codes, sort the array so that the highest priority products come at the beginning of the array, the medium priority products come in the middle, and the low priority customers come at the end. Within a priority group, order does not matter. You are given a priority function which, given a product code, returns 1 for high, 2 for medium and 3 for low. This array may contain a large number of product codes, so do your best to minimize additional storage.
- job_seeker May 17, 2017 in United States| Report Duplicate | Flag | PURGE
SDE-2 Data Structures - 0of 0 votes
AnswersProducts are identified by alphanumeric codes. Each code is stored as a string. We have three types of products:high priority, medium priority, and low priority. Given an array of product codes, sort the array so that the highest priority products come at the beginning of the array, the medium priority products come in the middle, and the low priority customers come at the end. Within a priority group, order does not matter. You are given a priority function which, given a product code, returns 1 for high, 2 for medium and 3 for low. This array may contain a large number of product codes, so do your best to minimize additional storage.
- job_seeker May 17, 2017 in United States| Report Duplicate | Flag | PURGE
SDE-2 Data Structures - 0of 0 votes
AnswerDesign entity(model) structure of a file systems. You don't have to write any interfaces, just various models and their properties.
- sonesh May 11, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 0of 0 votes
AnswersYou have to desing a system for a shop kepper to keep his/her inventory managed. He/she have furniture at the begining, but he may add more items to it. His/her furnitures are wood char, wood table, steel chair, etc.
- sonesh May 11, 2017 in United States
Each furniture have one property, a boolean one, called isChildSafe.
Later, he said, what if the shopkeeper wants to add new type of items, such as phone or may be something else, and he/she might also wants to add two new properties, such as isFireSafe, isWaterSafe etc.
How would you design extend to these types.| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 0of 0 votes
AnswersYou have to design a job scheduler. The job schedular should be able to accept all kind of jobs, small or long running. Multiple systems might be adding jobs to it and multiple systems should be able to execute jobs simultaneously.
- sonesh May 11, 2017 in United States
Please list down the components and data flows between them, what kind of interfaces you will be having, what kind of retry logic you will be providing, storage and middle tier design was also asked.| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 4of 4 votes
AnswersYou are given set of strings, You have return anagrams subsets from it. An anagram set is that one where every string is an anagram of another string. If the subset contains only one string, don't include that in the result.
- sonesh May 11, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm String Manipulation - 0of 0 votes
AnswersYou are given a NxN boolean matrix, where matrix(i,j) will be one if 'i' is a parent of 'j' in a tree, otherwise, it is zero.
- sonesh May 11, 2017 in United States
Construct this tree.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm Trees and Graphs - 0of 0 votes
AnswerDesign/Implement an LRU cache so that Read/Write/Find operation only takes constant time.
- sonesh May 11, 2017 in United States
Now, Let's say, we will be considering the frequency as well. It means to keep the most used processes and in a case of the tie, use lease recently used to remove an element.
Now, as this new algorithm can cause many hits, or no new process will come to the cache if the last process of the cache has two hits., What can you do to prevent this, and how would you implement that.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm design - 1of 1 vote
AnswersThere is a cluster of servers. In this cluster some group of servers are running application A, some group are running B, etc. Each application server produces huge logs and the log file sizes run into GBs. Each minute there are millions of log entries.
- Curious May 09, 2017 in India
You need to design a system that allows you to:
1. Specify the name of the application whose logs you want to search.
2. Search any text that the log message may contain.
3. Search within a time stamp range.
4. Search within the specified log level(s).
The system should be real-time.| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 1of 1 vote
AnswersIt is presidential election time.Mr X is fighting for the president.The country has N number of cities.
- hitansu166 May 04, 2017 in India for Aelxa
The cities are divided into developed & developing city on basis of a developemt index A.
If A is 1, then the city is developed. If A is 0, then the city is developing.
A close source to Mr X told that all the people from developing cities will vote for him while people
from only k number of developed cities will vote for him.
Find out the no of maximum vote in favour & minimum vote in against Mr X will get.
Input
------
10 3
0 12
0 6
0 7
1 8
1 12
1 17
1 20
1 22
1 5
1 6
First 2 line gives no of cities N= 10 & number of developed cities vote for Mr X k= 3
Next 10 lines give the development index A & number of people in the city
For example in the first line A= 0, no of people= 12| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 1of 1 vote
AnswersConstructing City
- hitansu166 May 03, 2017 in India for Alexa
In a country the cities are connected through roads of 3 types 1, 2, 3.
All the roads are bi-directional. The roads of a city has some restriction.
Road of type 3: both men and women can walk
Road of type 2: only women can walk
Road of type 1: only men can walk
Now the govt. wants to remove extra roads.But the cities should be connected for both men & women.
Connected means one should able to reach from one city to other & vice-versa.
Find out the maximum no of roads can be removed so that the cities can be accessible to both men & women.
Input:
5 5
1 2 3
2 3 3
3 4 3
5 3 2
5 4 1
First line gives no of cities & no of roads. Next each 5 lines gives city source, city destination, type for a roads.
5: no of cities 5: no of roads
1: city-1 2: city-2 3: type 3 road
o/p: 2| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 0of 0 votes
AnswersWrite a program which takes input a sorted array and positive number and updates the array so that if x appears m times in array then it appears exactly min(2,m) times in array. the update should be performed in one pass with no additional memory
- ashishsaraswat.iips April 17, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Arrays - 0of 0 votes
AnswersDesign a system to monitor services (like when they were down/ CPU time) etc.
- usri April 10, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 0of 0 votes
AnswerDesign a system for dashboard that effectively shows almost real time data.
- usri April 10, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 2of 2 votes
AnswersGiven a sorted array with "n" elements, distributed them into "k" nearly equally weighing buckets.
- reddy88 April 02, 2017 in United States
Space is not constraint.
Ex: [1,3,6,9,10]
bucket size: 3
output:[10],[9,1],[3,6]| Report Duplicate | Flag | PURGE
Amazon SDE-2 Dynamic Programming - 3of 3 votes
AnswersDesign backend system for bookMyShow.com like system which supports below use cases:
- Priyanka March 29, 2017 in India
1) When user selects cities, list of cities is displayed.
2) When user selects city, movie list is displayed.
3) When user selects movie, list of theatre is displayed.
4) When user selects theatre, show timing is displayed.
5) When show timing is selected, user is asked for no of seats that he wants to book
6) When user selects no of seats, seats are displayed to choose from.
7) When user selects seats, then total price is displayed.
8) When total price is selected, then user is directed to payment gateway and payment is done and on payment success, ticket is mailed to him.
More questions on how can we scale the system, and handle concurrent users request for same seat etc.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 2of 2 votes
AnswerDesign a movie ticket booking system like bookmyshow.com
- neer.1304 March 29, 2017 in United States
Follow-up question -
1) How do you handle issues like scalability, concurrency, fault-tolerance etc.
2) Show movie theaters near to user where movie is playing and seats are available
3) Design database. What kind of DB would you use SQL or No-SQL
4) In real time how would you show which seats are booked which are free
5) If theaters do not have any api for fetching information then what can we do about it.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 1of 1 vote
AnswersDesign Uber. Low level Design needed (OOPS based - classes, relations, message flow etc.)
- neer.1304 March 28, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 0of 0 votes
AnswerDesign Cricinfo website
- neer.1304 March 28, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 0of 0 votes
AnswersDesign snake n ladder game to be played online
- neer.1304 March 28, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 0of 0 votes
AnswersGiven a movie X that the user had watched, write an algorithm to suggest more movies to the user. How to display the other movies based on same genre?
- suneel March 24, 2017 in India| Report Duplicate | Flag | PURGE
ADP SDE-2 Algorithm - 0of 0 votes
AnswersHow to Design an Meeting scheduler
- DuttaJ March 23, 2017 in India| Report Duplicate | Flag | PURGE
Flipkart SDE-2 Algorithm - 0of 0 votes
AnswersImplement a Message Broker, with Publisher and Subscriber. There can be multiple Topic or Subject in Message Broker.
- DuttaJ March 23, 2017 in India| Report Duplicate | Flag | PURGE
Flipkart SDE-2 Coding - 0of 0 votes
AnswersImplement Thread safe timer with start, stop and reset functionality.
- twarzo March 22, 2017 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Threads - -1of 1 vote
AnswersFind K which decides the number of open brackets are equal to the number of closed brackets.
- SmashDUNK March 21, 2017 in United States
input : (())
output : 2
Reason : if we divide the string at 2nd position, we get two open brackets and two closing brackets, and they are same .
input : (())))(
output : 4
Reason : if we divide the string(not necessarily equally) at 4rth position, we have (()) on the left side and on the right side we have ))( , as you can see, on the left half, we have two opening brackets and on the right half we have two closing brackets and they are equal .
input : ))
output : 2
Reason : there is no open brackets , so if we divide taking the whole string's length, we have )) on the left half and nothing on the right half. Now you can see that on the left half there is no open brackets and on the right half there is no closed brackets.
This question should be clear by now and remember you have to find out that K .| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersFind the Maximum number of distinct nodes in a binary tree path
- SmashDUNK March 20, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
Answersfind the given Binary tree is mirrored tree or not
- Jagadeesh March 12, 2017 in India for Kindle
should be like
60
/ \
30 30
/ \ / \
20 50 50 20| Report Duplicate | Flag | PURGE
Amazon SDE-2 Trees and Graphs
Open Chat in New Window