Amazon Interview Questions
- 0of 0 votes
AnswersYou are given a stream of numbers which represent the stock prices of a company with timestamp. You need to perform some set of operations on the stream of data efficiently as below: 1. findStockPriceAtGivenTimeStamp(Timestamp) 2. deleteAndGetMinimumStockPriceForToday() Timstamp: 1 2 3 . 4 . 5 Prices: 12 34 4 . 1 . 18
- bholeNath September 18, 2017 in India| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Structures - 0of 0 votes
AnswersDesign online multiplayer generic board game (like chess). How will you store sessions.(RDBMS or REDIS) How will the
- gauravkumar1491 September 13, 2017 in India
competitor be chosen and notified(HTTP or what?).
What are the appropriate classes?| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswerDesign Recommendation system. How will you generate generate recommendations for millions of users. DB Schema, How will you improve latency? if the user is searching a item, when will you show next recommendations. How will you update, latency basically and consistency.
- gauravkumar1491 September 13, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswersYou are provided with 2D char array. You have to provide the 2D char array as response which contains the multiplication od the input array. For eg: input=> {{a,b},{c,d}}, output => {{a,c},{a,d},{b,c},{b,d}}
- gauravkumar1491 September 13, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Coding - 0of 0 votes
AnswersYou are provided with different Excel files and the data format those files contain. You are also provided with low level parser. You have to design a system which takes the excel file and its data type as the input and returns the list of Data objects in the file.
- gauravkumar1491 September 13, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 1of 1 vote
AnswersDesign JProfiler. How will you design datastructure and why, function stacktrace. HLD+LLD
- gauravkumar1491 September 13, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswersDesign a Fresh Grocery System. Means Daily usable Items, you cannot store them in inventory like bread, milk etc.
- gauravkumar1491 September 13, 2017 in India
HLD+ DB Schema + Concurrency issues + Scalable architecture. How will you scale to multiple countries| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 1of 1 vote
AnswersHow to develop a web based multiplayer chess game. There will be 2 player in each session. There will be multiple sessions.
- mohapatrasandeep60 September 11, 2017 in India for no
My answer(I was not selected)
Each player will have a database with columns
user id(primary key), passwd,no of games played, won,drawn,last active time,sq1,sq2,...sq64,move made flag,pawn num, sqstart,sqend
where sq1-denotes square 1 and its value represents the pawn num in sq1
question- what all fields in database will be encrypted
answer-passwd
question- why not others
answer-may be system admin needs to access them
question – how will u start a session between players?
Answer-When a player logs in, his last active time is updated. Each player is shown a list of last active players to chose from.Or system can arbitrarily select one.When a player is selected, he gets a request. Each player receives a list of requests from other players. He choses from one. That player gets an acknowledgement others get negative acknowledgement. If acknowledgement does not come in time then that player is dropped and another player is selected.
Question- http connection, can not send request from server. How the 2 players will send request to each other and how session will be initiated?
Question-how the game will be stored?
The 64 squares sq1,sq2,..sq64 will each store the pawn number in them. From random number calculatio, it will be decided which one is white and which one is black 1st time. When a player makes move,has made move flag will be true. The last move is stored as sqstart,sqend,pawn number. Each time a move is made check for valid move.The other player continuously polls for has made move flag to know if it is his turn
remarks- ur design is not scalable.| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 0of 0 votes
AnswersYou are given a Log that contains UserId, ProcessId, Start Time, End Time and Resource Consumption during that time, you need to find out the user who has utilized the most resources.
Example:UID PID StartTime EndTime Consumption
1 1 200 300 100
2 2 230 340 80
1 3 245 315 50
1 4 305 330 20
Time 200 signifies: 02:00.
- CodeNinja September 10, 2017 in United States for AWS
Output: UID# 1
UserID 1 because he has consumed the most number of resources between 200 to 315 (Resource Consumption: 150).| Report Duplicate | Flag | PURGE
Amazon SDE-2 Hash Table Problem Solving - 1of 3 votes
AnswersDesign an order tracking system using the below constraints.
- gauravkumar1491 September 07, 2017 in India
Once an order is received, it will be assigned to a delivery boy and sends notification at every stage of the order such as order received with expected time of delivery, delivery boy assigned, order picked up, order delivered.
State how your design will help scale and what will be the performance SLAs that will you will set for your design. The system should be able to horizontally scalable from hundreds of orders to million orders and should perform at almost the same level irrespective of the number of orders received.| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswersAdd a digit to a number that is represented by a linked list, where each node is a digit of the number. The linked list couldn’t be modified, except the digits to be modified in answer and the number could be infinitely long. Need to do it in O(1) space.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersFind the Minimum length Unsorted Subarray, sorting which makes the complete array sorted
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersMaximum difference between node and its ancestor in Binary Tree in O(n) time.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven MxN binary matrix, find the largest sub-square matrix with all 1’s.
- neer.1304 August 31, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersDesign a geographically partitioned multi-player card game, that supports multiple players, multiple games at a time.
- neer.1304 August 31, 2017 in United States
Each game will have one contractor like ones we have in a bar, He can play a game or just watch it. Integrate payment systems.
First HLD was required, use cases, flow diagram. then a low level design was required all necessary classes where will you use polymorphism, where inheritance, multithreading, synchronised approach if needed, socket connections| Report Duplicate | Flag | PURGE
Amazon SDE-3 design - 2of 2 votes
AnswersDesign a Netflix type system. Start from HLD to LLD.
- neer.1304 August 31, 2017 in United States
Consider requirements like search, video serving, authentication, security, serving multi quality video.| Report Duplicate | Flag | PURGE
Amazon SDE-3 design - 0of 0 votes
AnswersGiven an array of integers. We need to answer two types of queries point update and range sum in minimum time.
- neer.1304 August 31, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersPut the given random pointers in linkedlist to point to next greater node such that if you transverse the list using random pointers, list become sorted. duplicates are allowed.
- neer.1304 August 31, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 1of 1 vote
AnswersFind third highest value in a binary tree
- neer.1304 August 31, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersYou are given a set of N horizontal lines which are connected by equal number of vertical lines to form squares of size 1x1. Now some segments are removed. You need to count the number of squares of all sizes (1x1, 2x2, ..., NxN) with all sides present.
- imunique August 30, 2017 in India
Image : https://he-s3.s3.amazonaws.com/media/uploads/1ce3516.png
In the above example you see four horizontal and vertical lines and few missing segments. Now you need to count the number of squares of all sizes with all sides.
Input :
First line is a positive integer N, number of horizontal and vertical lines.
Second line is positive integer M, number of segments removed.
Then there are m lines, each containing V,i,j or H,i,j where i and j are positive integers. H,i,j indicates a horizontal missing segment in the ith horizontal line between the jth and (j+1)th point on the line. V,i,j represents a gap in ith vertical line between the jth and (j+1)th point on the line.
Output :
Is the total number of squares in the figure with all sides along the remaining lines in the figure.
Sample Input :
4
4
H,2,1
H,3,1
V,2,2
V,2,3
Output :
5
Explanation : Here in this figure we have 4 squares of size 1x1 and 1 square of size 3x3, hence total is 5.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm Data Structures Dynamic Programming Online Test Problem Solving - 0of 0 votes
AnswersGiven data of millions of people, (name, age, M/F etc.) Develop an API that will have age range as input and yield the count of people under this range as output.
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswerA T20 match is going on. You’re in Team B. First innings is over, they have scored “teamARuns” runs. Your team has scored “teamBRuns” runs at the end of “balls” balls. A ball can have multiple possibilities like [0, 1, 2, 3, 4, 5, 6, Wicket, No ball, Wide ball]. What is the probability that your team (Team B) will win?
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven a dictionary of words and a string pattern. Output the count of words that match the string pattern in the dictionary.
- neer.1304 August 30, 2017 in United States
Eg. Dictionary: [cat, rat, mat, apple, boy, bat]
String pattern: ?at
Output: 4 (because cat, rat, mat, bat matches the string pattern)| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven any two nodes in a binary tree, find the path from 1st node to another, and tell if the path is a straight line, or there are turns on the line, find number of turns.
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersFind the maximum difference between any combination of child and parent node in a given binary tree. Here child node can be any level below parent node, but should be in the same sub tree starting from parent node.
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersDesign Truecaller. Both HLD and LLD.
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 0of 0 votes
AnswersGiven a chessboard, find minimum number of moves for a knight to reach from source to destination.
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswerGiven a fully connected graph with n nodes and corresponding values. One node can interact with other node at a time, to replace/ignore/add its value to other node’s value. Assuming this operation takes 1 unit of time, how much time would it take for all the nodes to have value equal to sum of all the nodes.
- neer.1304 August 30, 2017 in United States
Examples : Given a graph with values {1,2,3,4}, find total time it takes, such that all nodes have value as 10.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersGiven a Singly Linked list, Update the second half of the list such that n-th element becomes sum(1st + nth) element, (n-1)st element becomes sum(2nd + n-1st) element and so on. Eg: 2->3->4->5->6 => 2->3->(4+4)->(5+3)->(6+2)
- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven an Infinite stream of strings as AAAAABBBCCDDDEEE… How will you arrange characters so that string become unique without duplicates .
- neer.1304 August 30, 2017 in United States
Return true if it is possible to arrange else return -1.
Ex . AAABBCCDEF – O/p ABABCDCEF : Possible . AAAAAAAAAAAAAAAAAAAAAAB : Not possible| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm