Amazon Interview Questions
- 0of 0 votes
AnswersDesign Elevator system. And then write an algorithm for that Design such that, the user request should be completed in logN time in a N story building with M elevators.
- shaileshagarwal1 June 15, 2015 in India for Transportation Team| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 0of 0 votes
AnswerIn an online teaching system, there are n number of teachers and each one teaches only one subject to any number of students.
- shaileshagarwal1 June 15, 2015 in India for Transportation Team
And a student can join to any number of teachers to learn those subjects.
And each student can give one preference through which he can get updates about the subject or class timings etc.
Those preferences can be through SMS or twitter/facebook or email..etc.
Design above system and draw the diagram for above.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 0of 0 votes
AnswersHow to design a LRU cache using heap(priority queue) ?
- Anand Barnwal June 13, 2015 in India| Report Duplicate | Flag | PURGE
Amazon Intern design - 3of 3 votes
AnswersRotate a array by N. N can be smaller of greater than the array length.
- someone June 10, 2015 in United States
e.g {0,1,2,4,5,6,7} N =4 should return {5,6,7,4,0,1,2}.
1) I did this using extra array but next I was asked to do without extra array and in o(n) time.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswerGiven two strings, how to find the longest common substring ?
- Anand Barnwal June 09, 2015 in India
Can it be implemented using suffix tree ? If then elaborate with an example.| Report Duplicate | Flag | PURGE
Amazon Intern Algorithm - -3of 7 votes
AnswersI have telephonic interview with amazon ? What will they ask? do they ask on algorithms,OOPs, data structure?
- aashish.lad June 08, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersDoes JavaScript has inheritance?
- Tom Walker June 07, 2015 in United States
Can you override in JavaScript?| Report Duplicate | Flag | PURGE
Amazon Software Developer Java JavaScript Object Oriented Design - 0of 0 votes
AnswersWhat's difference between Javascript and JAVA in terms of OOP principles. Provide examples.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Coding Java JavaScript Object Oriented Design - 0of 0 votes
AnswersIf given a binary file, with data like lat, long, weather, temp in key:value. It's a structured data how would u ingest it. what are the steps that are being taken before Hive process starts.
- Tom Walker June 07, 2015 in United States
- serde (serializartion deserialization). parque etc.| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm Data Mining Data Structures Database Distributed Computing Java SQL - 0of 0 votes
AnswersLets say if Mongo captures user views and oracle captures purchases. How would you design realtime system that answers question "give me avg. no. of views of users by purchases".
- Tom Walker June 07, 2015 in United States
So if a user watch a trailer 10 times and then decides to buy a video. How would you calculate it. He was looking for QUEUE.
He could have gone on more details but stopped because i didn't give details on this.| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database - 1of 1 vote
AnswersWrite sql to get occurence of characters in given column
- Tom Walker June 07, 2015 in United States
Remove duplicate rows from sql table leaving one unique row.| Report Duplicate | Flag | PURGE
Amazon Software Developer SQL System Design - 1of 1 vote
AnswersHow would you increase efficiency of a hive query?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Debugging SQL - 0of 0 votes
AnswerWhat is distribute cache in Hadoop?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Structures Database - 0of 0 votes
AnswerWhat do you mean by combiner?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Distributed Computing - 0of 0 votes
AnswersAfter map phase partition, shifting, sorting happen. What does it mean?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Java - 0of 0 votes
AnswerWhat is input split in hadoop.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Java SQL - 0of 0 votes
AnswersAs I interviewing for Big data position. Asked Hadoop question :-
- Tom Walker June 07, 2015 in United States
Difference between TextInput vs Key Value format in Hadoop.| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Mining Data Structures Database Java design - 5of 5 votes
AnswersSay you have a keypad that has keys for the numbers 0 through 9 and the correct code is some sequence of 5 digits. This keypad does *not* reset after entering an incorrect sequence of 5 digits. ie. If the correct sequence is 12345, entering 7512345 will succeed in opening it because it ends in the correct sequence. If the keypad actually resets after every 5 digits pressed, then it would not succeed b/c it would interpret the above sequence as "75123" then "45".
- Jason May 30, 2015 in United States
1. Write an algorithm that will try to find the correct code for this keypad. Assume you have an API similar to KeyPad.pressKey(int n) where you pass in a number (0...9) and it returns true if the keypad unlocks and false if it's still locked.
Note that you could easily enter all digits of all numbers 00000 through 99999 resulting in 5*100000 key presses, but remember that the panel does not reset after every sequence of 5 digits, so find a way to do this more efficiently. Notice for example that entering the stream 3791283780 will test the length 5 sequences 37912, 79128, 91283, 12837, 28378, 83780; not only the two disjoint sequences 37912 and 83780.
Think of this keypad as remembering the last 4 keys pressed (and the order pressed); when the next key is pressed, if the last 4 keys + the current key equal the correct code, the keypad will unlock. Assume the keypad does all this internally, so you can just keep feeding it keypresses and it will eventually unlock if the last 5 keypresses entered is the correct code.
2. Generalize your algorithm to work for a keypad where you don't know the length of the correct sequence in advance.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSuppose you are given a puzzle that is represented as a matrix with 0s and 1s, where a 0 indicates you’re allowed to move into that position and 1 means you’re not allowed to move in that position. Write a function that given a start position and an end position, returns a boolean value indicating if there exists a path from start to end. you are only allowed to move up, left, right and down. Diagonal movement is not allowed.
- anom May 28, 2015 in United States
Example #1
Input
0 0 1 0 1
0 0 0 0 0
0 1 1 1 1
0 1 1 0 0
start: 4,1
end 0,3
Output - true
Example #2
Input
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
0 0 0 0 1
start: 0,0
end: 1,2
Output - false| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java - 1of 1 vote
AnswersImplement a function that returns the i-th most popular item sold
- anom May 28, 2015 in United States
at xyz company. You cannot rely on any libraries.
Class Item {
String itemId;
int quantitySold;
}
/**
find the i-th most popular item in the list
**/
String find(List<Item> items, int i) {
// your code goes here
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java - 0of 0 votes
AnswersSuppose you are given a puzzle that is represented as a matrix with 0s and 1s, where a 0 indicates you’re allowed to move into that position and 1 means you’re not allowed to move in that position. Write a function that given a start position and an end position, returns a boolean value indicating if there exists a path from start to end. you are only allowed to move up, left, right and down. Diagonal movement is not allowed.
- anom May 28, 2015 in United States
Example #1
Input
0 0 1 0 1
0 0 0 0 0
0 1 1 1 1
0 1 1 0 0
start: 4,1
end 0,3
Output - true
Example #2
Input
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
0 0 0 0 1
start: 0,0
end: 1,2
Output - false| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
Answers--Suppose that we have an array of m by n size. Each element is binary, so it can either be 1 or 0. Design an algorithm that for a given array, the return is a set arrays containing the nodes that are adjecent to each other.
- maksymas May 26, 2015 in United States
For example:
1 2 3 4 5 6 7 8
---------------
1|0 0 0 0 0 0 0 1
2|0 0 0 0 1 0 0 1
3|0 0 0 1 0 0 0 0
4|0 1 1 1 1 0 0 0
5|0 0 0 0 1 0 0 0
Returns:
Array1 {(8,1) (8,2)}
Array2 {(5,2) (4,3) (2,4) (3,4) (4,4) (5,4) (5,5)}| Report Duplicate | Flag | PURGE
Amazon Development Support Engineer Algorithm - 0of 0 votes
AnswersGiven set of job schedules with start and end time, write a function that returns indexes of overlapping sets.
- Tom Walker May 13, 2015 in United States
for ex :-
input -> [1,2][5,6][1,5][7,8][1,6]
return -> [0,1,2,4]| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersWrite a function that accepts root of a binary tree and print zigzag level order traversal, each level print in new line.
- jaip42 May 10, 2015 in India for Kindle
For example,
Given tree:
1
2 3
4 5 6 7
8 9
output:
1
2 3
7 6 5 4
8 9| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 0of 0 votes
AnswersWrite a function that accepts root of a binary tree and return true if it is foldable otherwise return false. A binary tree is foldable if left subtree of root is mirror image if right subtree.
- jaip42 May 10, 2015 in India for Kindle
For example:
Given tree,
1
2 3
4 5 5 4
6 6
output: true| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersWrite a function that accepts root of a binary tree and return true if it is foldable otherwise return false. A binary tree is foldable if left subtree of root is mirror image if right subtree.
- jaip42 May 10, 2015 in India for Kindle
For example:
Given tree,
1
2 3
4 5 5 4
6 6
output: trus| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 1of 1 vote
AnswersWrite a function that accepts root of a binary tree and print zigzag level order traversal, each level print in new line.
- jaip42 May 10, 2015 in India for Kindle
For example,
Given tree:
1
2 3
4 5 6 7
8 9
output:
1
2 3
7 6 5 4
8 9| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 2of 2 votes
AnswersWrite a function that accepts two character arrays each represents a floating point number and return their sum in character array.
- jaip42 May 10, 2015 in India for Kindle
For example function accepts "23.45" and "2.5" and return their sum "25.95".
Restriction: We cannot use predefined functions / methods or parsing. We have to go with basic operations.| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 0of 2 votes
AnswersWrite code to rotate a square matrix:
- doomguy May 04, 2015 in United States
Input:
1 2 3
4 5 6
7 8 9
Output:
4 1 2
7 5 3
8 9 6| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures