Amazon Interview Questions
- -1of 1 vote
AnswersGiven a stream of objects, O1, O2, O1, O3, O4... Provide an algorithm to identify the first unique object at any given point in time.
- abhi10901 May 31, 2017 in United States for AWS Auto Scaling
So for example, in the above, after receiving the first Object, it is unique. After receiving the second, the first is still the first unique object. After receiving the 3rd, the 1st object is no longer unique (you've not seen O1 twice), so O2 is not the first unique object. etc...| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
Answershow to implement a Wish List like this one
- ajay.raj May 30, 2017 in United States
https://www.amazon.com/hz/wishlist/intro| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersWhat is the cost / complexity of a String.indexof() function call in java?
- ajay.raj May 08, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersHow to check the validity of a 4 digit credit card expiration date (mm/yy)
- ajay.raj May 06, 2017 in United States
that still works 100 years from now.
public boolean isValid(String s){
}| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersWrite a function that returns true if the binary representation of an integer is a palindrome.
- maxxwizard May 03, 2017 in United States for Marketplace
9 = 1001 = palindrome
8 = 1000 = not palindrome| Report Duplicate | Flag | PURGE
Amazon SDE1 Java - 0of 0 votes
Answershow does java implement priority queue?
- ajay.raj April 25, 2017 in United States
i answered min heap, the interviewer seemed it was not right| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersGiven a decendents of nodes, write an algorithm to find whether it is a tree or a graph?
- optimisticsuperman March 07, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
Answercount Number of balanced Binary Tree given Preorder Sequence length
- ajay.raj March 02, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersGiven an array arr and a number n, you have to find whether there exist a subset in arr whose sum is n. You have to print length of the subset.
- mohit February 17, 2017 in India
1. There exists only one subset like that
2. All number in arr are positive| Report Duplicate | Flag | PURGE
Amazon SDE1 Dynamic Programming - 0of 0 votes
AnswersI have a file which has a number of 10 digit numerals and 10 digit alphanumeric characters. Write a UNIX basic command to print distinct 10 digit alphanumeric charters
- priyanka.mandal1691 February 08, 2017 in India
Sample Input
1234567890
1234567890
123456789X
0974385495
Expected O/P
123456789X| Report Duplicate | Flag | PURGE
Amazon SDE1 Unix - 0of 0 votes
AnswerDelete files of size more than 100mb in a folder which are older than 90 days.
- priyanka.mandal1691 February 08, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Unix - 0of 0 votes
AnswersGiven a comma separated file print the last but one column of every line.
- priyanka.mandal1691 February 08, 2017 in India
e.g:
a,b,c,d,e,f
1,2,3,4
w,x,y,z
output should be
e
3
y| Report Duplicate | Flag | PURGE
Amazon SDE1 Unix - 0of 0 votes
AnswersA binary tree and a number, say k are given. Print every path in the tree with sum of the nodes in the path as k.(A path can start from any node and end at any node, i.e. they need not be root node and leaf node; and negative numbers can also be there in the tree)
- SIVA R February 07, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 1of 5 votes
AnswersFind sum of n elements after kth smallest element in BST. Tree is very large, you are not allowed to traverse the tree.
- gvikram244 December 06, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven the following inputs, return a list of rooms that are available and large enough:
- MM August 04, 2016 in United States
# of people
Start Time
End Time
You should return
total list of rooms
capacity of each rooms
availability| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 2of 2 votes
Answers10000 cameras, 100 hours of video each. 30 fps. Police need to input a plate number and find the path of a suspicious vehicle. (Estimate the size of the video, e.g., blueray disc is 2 hours and 20 GB. No need to scan all of the videos. Estimate the time that a vehicle can be seen between 2 traffic cameras, e.g., 0.3 miles and 30 miles per hour, then select 1 out of 100). Web client, load balancer, servers, db.
- kwangrand July 31, 2016 in United States for Kindle| Report Duplicate | Flag | PURGE
Amazon SDE1 System Design - 2of 2 votes
AnswersGiven some resources in the form of linked list you have to canceled out all the resources whose sum up to 0(Zero) and return the remaining list.
- ganesh.eng2015 July 24, 2016 in India
E.g-->> 6 -6 8 4 -12 9 8 -8
the above example lists which gets canceled :
6 -6
8 4 -12
8 -8
o/p : 9
case 3 : 4 6 -10 8 9 10 -19 10 -18 20 25
O/P : 20 25| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersIn an incoming stream of +ve integers, return true if 2 numbers with sum equal to 10 has occurred till now.
- ganesh.eng2015 July 24, 2016 in India
How to handle stream of numbers| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven an array,find all valid ip-address form this array.
- ganesh.eng2015 July 24, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 2of 2 votes
AnswersYou want to design a Cab system which will show you nearest 5 taxis.
- Shanky.Q3 July 04, 2016 in United States
Each taxi will continuously emit (x,y) coordinates.
You need to print the nearest 5 taxis from (p,q).| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersThere are n number of conference rooms available in a company for the meeting. You need to book a meeting for a particular time slot. Write an algorithm to determine the number of conference rooms available for the meeting with given start time and end time.
- coder May 17, 2016 in United States for Devices
Hint: any conference room with non- overlapping meeting will be selected.| Report Duplicate | Flag | PURGE
Amazon SDE1 Trees and Graphs - 0of 0 votes
AnswersFinding Peak element in an array
- sivarasu.net May 03, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersDesign an Algorithm for Amazon Advertisement Page
- suneel March 10, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 2 votes
AnswersGiven N ropes of lengths L1, L2, L3, L4, …, LN. I had to join every rope to get a final rope of length L1 + L2 + … + LN.
- ash.taunk3 February 24, 2016 in India
However, I can join only two ropes at a time and the cost of joining the two ropes is L1 + L2. I was supposed to join ropes in such a way that the cost is minimum.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersThis is was asked in Amazon SDE online test from Hacker rank.
- sandeepparekh9 January 20, 2016 in Hong Kong
Initech is a company which has CEO Bill and a hierarchy of employees. Employees can have a list of other employees reporting to them, which can themselves have reports, and so on. An employee with at least one report is called a manager.
Please implement the closestCommonManager method to find the closest manager (i.e. farthest from the CEO) to two employees. You may assume that all employees eventually report up to the CEO.
Tree structure:
Bill -> Dom, Samir, Michael
Dom -> Bob, Peter, Porter
Peter -> Milton, Nina
Sample Data:
CEO Bill has 3 employees reporting to him: {Dom, Samir, Michael}
Dom has three reports { Peter, Bob, Porter}
Samir has no reports {}
Michael has no reports {}
Peter has 2 reports {Milton, Nina}
Bob has no reports {}
Porter has no reports {}
Milton has no reports {}
Nina has no reports {}
Sample calls:
closestCommonManager(Milton, Nina) = Peter
closestCommonManager(Nina, Porter) = Dom
closestCommonManager(Nina, Samir) = Bill
closestCommonManager(Peter, Nina) = Peter| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - -1of 3 votes
AnswersGiven a 1D array, implement function Sum(x1,x2) where x1 and x2 are indices of array. Find sum of all elements in between the given indices inclusive of them. Do in Time complexity of O(1)
- lol12345 October 27, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 4of 4 votes
AnswersGiven a linkedlist, write an algorithm to divide the linkedlist into two linkedlists, the first contains the Fibonacci numbers in the list and the second contains the non-Fibonacci numbers.
- a.ahmed.shalabey October 23, 2015 in United States for Software Development
Test the algorithm after developing the code| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm C Data Structures - 4of 4 votes
AnswersGiven three arrays A,B,C containing unsorted numbers. Find three numbers a, b, c from each of array A, B, C such that |a-b|+|b-c| +|c-a| is minimum.
- Rahul Sharma September 16, 2015 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm