SDE-2 Interview Questions
- 0of 0 votes
AnswersDesign Uber low level OO design. Cater to use cases like search for a ride, different category of rides, select a ride, registration for a user and driver, paying for ride etc.
- neer.1304 December 06, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 1of 1 vote
AnswersGiven a dictionary and an char array print all the valid words that are possible using char from the array.
- neer.1304 December 02, 2016 in United States
Ex- char[] arr = {'e','o','b', 'a','m','g', 'l'}
Dict - {"go","bat","me","eat","goal", "boy", "run"}
Print - go, me, goal.
We can pre-compute as much we want but the query time must be optimal.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersGiven input which is vector of log entries of some online system each entry is something like (user_name, login_time, logout_time), come up with an algorithm with outputs number of users logged in the system at each time slot in the input, output should contain only the time slot which are in the input. For the example given below output should contain timeslots
- ann November 22, 2016 in United States
[(1.2, 1), (3.1, 2), (4.5, 1), (6.7, 0), (8.9, 1), (10.3,0)]
/*
[
("Jane", 1.2, 4.5),
("Jin", 3.1, 6.7),
("June", 8.9, 10.3)
]
=>
[(1.2, 1), (3.1, 2), (4.5, 1), (6.7, 0), (8.9, 1), (10.3, 0)]
*/| Report Duplicate | Flag | PURGE
Uber SDE-2 - 0of 2 votes
AnswersHow would you design Amazon Lockers?
- teli.vaibhav October 30, 2016 in United States
Amazon Lockers - Customers can use these lockers to have their products delivered. These lockers are physically available to customers at the same or several nearby zip codes.| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 0of 0 votes
AnswersThe amazon site was working just fine until yesterday. But in the past 24 hours processing the customer orders is taking a really long time.
- teli.vaibhav October 30, 2016 in United States
How would you debug and fix the issue?
When I asked if anything had changed in the past 24 hours, I was told several new products had been added after which the performance issues were noticed.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Debugging - 3of 3 votes
AnswersGiven the root of a Binary Tree along with two integer values. Assume that both integers are present in the tree.
- teli.vaibhav October 30, 2016 in United States
Find the LCA (Least Common Ancestor) of the two nodes with values of the given integers.
2 pass solution is easy. You must solve this in a single pass.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersYou are given 2 lists -
List 1: List<Demand> is a list of Demand objects.
List 2: List<Supply> is a list of Supply objects.
Return a result fulfillment List<Demand,List<Supply>>.
This means each demand could be satisfied by more than one supplies.class Demand { Date startDate; Date expirationDate; int quantity; } class Supply { Date startDate; Date expirationDate; int quantity; }
The Demand and Supply refers to that of groceries. You must map supplies to a demand only if the supply still has at least 3 days remaining to its expiration before the demand can be fulfilled.
- teli.vaibhav October 30, 2016 in United States
A demand is said to be fulfilled 24 hours after all demands have been mapped to correspondingly available supplies.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 2of 2 votes
AnswersGiven a string with only parenthesis. Check if the string is balanced.
- teli.vaibhav October 30, 2016 in United States
ex -
1) "<({()})[]> is balanced
2) "<({([)})[]> is not balanced| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - -1of 1 vote
AnswerWrite code for the partition subroutine in Quicksort.
- teli.vaibhav October 30, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswerHow would you Design a HashTable?
- teli.vaibhav October 30, 2016 in United States
In what ways would you attempt to address collisions?| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 4of 4 votes
AnswersGiven that an external service gives a list of credit cards that have become fraud, design a fraud management system for a shopping website for bookings with fraud credit cards
- mesmerizing.memories123 October 14, 2016| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 2 votes
AnswersGiven a list of shops each of which have a list of toys with their prices and max number of children who can play with it at a time. Output the a list of best possible toy option from each shop given the number of children who are shopping.
- mesmerizing.memories123 October 14, 2016 in India
ToyShopping
{
getListOfBestToysFromEachShop(List<Shop> shops);
}
Shop
{
int id,
List<Toy> listOfToys;
}
Toy
{
int toyId;
int shopId;
int price;
int maxChildren; //max number of children who can play with this toy
}| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersDesign the classes for a Battleship Game. Write the attack function.
- Ray October 04, 2016| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 1of 1 vote
AnswersWrite a program to check whether it is a valid binary tree or not. Check all test cases (e.g. No left Node case).
- Neelavan October 02, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswerGiven (a,b) can you reach to (c,d) if a and b can move either (a+b,b) or (a,a+b). Example a =1, b=4,c=5,d=9 then (1,4) -> (5,4) -> (5,9)
- karan.r.shah92 September 20, 2016 in United States| Report Duplicate | Flag | PURGE
A9 SDE-2 - 2of 2 votes
AnswersDesign a logging system. The system contains multiple application servers which are logging the information to file system. In this scenario, we want to check and alarm in case an exception is thrown in any of the servers. We want a system that checks for appearance of specific words, "Error", "Exception", "Disk Full" etc. in the logs of any of the servers. How would you design this system?
- jay September 17, 2016 in India
What if we want to scale the system in future?| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswerWe need a functionality to block an user who makes more than 10 requests in last 5 minutes. You need to implement the following function.
- rayasamharish September 14, 2016 in United States
{{
boolean block_user(int user_id)
{
//TODO: return true in case u want to block user
}
}}| Report Duplicate | Flag | PURGE
anonymous SDE-2 Algorithm - 0of 0 votes
Answersobject oriented design for robot vacuum cleaner.
- akash.umang August 30, 2016 in United States
write use cases, draw class diagram and interfaces
between them.| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 1of 1 vote
AnswersDesign a deck of cards that can be used for different card game applications.
- gurunathchoukekar August 17, 2016 in United States for AWS
Please code out what you would need for the deck class and a card class.
Implement a deal method.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 0of 0 votes
AnswersDesign a system for searching strings in files present on a fileserver under a directory. there won't be any sub-directories. There could be more than thousand/lakhs files. And the file size could be in GBs. The matching line should be written to a single file. user will execute grep "string"
- maske.s August 10, 2016 in United States
The sub-questions are
1) Design where the application executes on single machine.
2) Design where the application can execute on multiple machine.
3) Where could be the potential bottleneck.
4) What component would be bottleneck if 50 cores and slow disk.
5) What component would be the bottleneck if we 4 cores and fast disks.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 design - 2of 2 votes
AnswersYou have two very large numbers that cannot be stored in any available datatypes. How would you multiply them?
- confused_coder August 08, 2016 in United States
How would you multiply more than two numbers?| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 0of 0 votes
AnswersHow will you implement a dictionary.
- Nascent August 08, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 0of 0 votes
AnswerDesign a monitoring system for hotel booking site. Proper oops design.
- Nascent August 08, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 1of 1 vote
AnswersGiven two strings, print all the inter-leavings of the Strings in which characters from two strings should be in same order as they were in original strings.
- mrityunjay21 July 26, 2016 in United States for Payments
e.g.
for "abc", "de", print all of these:
adebc, abdec, adbce, deabc, dabce, etc, etc| Report Duplicate | Flag | PURGE
Amazon SDE-2 Behavioral - 2of 2 votes
AnswersGiven a matrix of positive integers, you have to reach from the top left corner to the bottom right in minimum cost. You can only go one square right, down or diagonally right-down. Cost is the sum of squares you've covered. Return the minimum cost.
- mrityunjay21 July 26, 2016 in India for Payments
e.g.
4 5 6
1 2 3
0 1 2
Answer: 8 (4+1+0+1+2)| Report Duplicate | Flag | PURGE
Amazon SDE-2 Dynamic Programming - 2of 2 votes
AnswersFind the length of maximum number of consecutive numbers jumbled up in an array.
- mrityunjay21 July 26, 2016 in India for Payments
e.g.: 1, 94, 93, 1000, 2, 92, 1001 should return 3 for 92, 93, 94| Report Duplicate | Flag | PURGE
Amazon SDE-2 Arrays - 2of 2 votes
AnswersA program stores total order numbers arrived at different time. For example, at 1.15 pm the program got 15 order, at 1.30 pm, the program got 20 order and so on.Now we need to design the data structure so that we can query the total orders we got in a time range efficiently. For this example, we can query as How many orders we have got between 1 and 2 pm? Ans will be 15+ 20 = 35
- gadha July 21, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures Java Object Oriented Design - -1of 1 vote
AnswersThis is a interview question which needs to be optimized for time.
- Abhi July 19, 2016 in India
Suppose you have a 2 dimensional Array and you have a String say "Amazon" inside the Array such that the individual characters can be present from Left to Right, Right to Left, Top to down and down to up.
I will explain with example :
char[][] a = {
{B,B,A,B,B,N},
{B,B,M,B,B,O},
{B,B,A,B,B,Z},
{N,O,Z,B,B,A},
{B,B,B,B,B,M},
{B,B,B,B,B,A}
};
The above Array has two Amazon Strings. You need to return the count of number of such strings present.| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 0of 0 votes
AnswersMilly and Pranjul are playing a game in which Pranjul will give an index of a chocolate.
- claud.qualityinfo July 14, 2016 in India
Then, Milly has to tell him the box number in which that chocolate is in. There are N
such boxes and Ci chocolates are there in ith the box. Description of index is given below
:
Suppose there are A1, A2 … AN chocolates in 1st, 2nd… Nth boxes respectively. So,
indexing of chocolates in 1st box will be from 1 to A1, similarly in 2nd box indexing will be
A1 + 1 to A2 … and indexing in Nth box will be from AN-1 + 1 to AN.
Milly is blind folded so she can’t see the boxes. You are required to help her.
Input
First line will contain N (No. of boxes). Next line will contain N space separated
integers denoting Ci, the number of chocolates in ith box.
Next line will contain Q (No. of times Pranjul will ask her). Then each next Q lines
will contain the asked index I.
Output
For every query, print in a new line : the box number in which that index of
chocolate is in.
Constraints
1 ≤ N, Q ≤ 105
1 ≤ Ci ≤ 10
1 ≤ Σ Ci ≤ 106
1 ≤ I ≤ Σ Ci| Report Duplicate | Flag | PURGE
Amazon SDE-2
Open Chat in New Window