Amazon Interview | Set 84
I attended a hiring event for Amazon in world trade center in bangalore.
First round was coding test (Written round) :
1. Given a string of parenthesis, write a function if it is balanced.
2. Convert BST to a Doubly linked list.
3. Find the number of occurrences of words in a paragraph.
First Round :
1. Asked Why Amazon?
2. Asked some questions on resume.
After some friendly talk, jumped on technical but easy questions :
1. Implement BFS.
2. Difference between Dijkstra and BFS.
3. Given a linked list, find out if the list is circular, also find the point from where the cycle start.
4. Given an array, find the max sum over a sub array.
5. If you have two eggs, how many max steps you need to find the floor, from which the eggs break.
And some more easy questions.
It was already 5, so they decided to have further rounds later.
10 days later I had attended interviews :
First Round :
1. Asked about heaps, given an array, tell if it is min heap, if not, apply operation min-heapify.
2. Is a heap a complete binary tree?
3. Asked What is hashmap.
a. What happens when two numbers map to same key?
b. how does chaining work?
c. What to do when you have a bad hashing function, and only we can modify the structure of hashmap not hashing function?
d. What do to when you your hashmap is filled completely (as in all the linked list are filled up to their capacity)
4. What is quicksort? Implement for a linked list and tell complexity.
Second Round :
1. What is quicksort?
a. What is complexity when all elements are sorted and how can you improve it? (Randomization)
b. Will randomization work when elements are same?
c. What algorithms sort equal elements in O(n) time ?
d. using the information, how can you improve quick-sort? Think about it, its good. Don’t want to spoil it for you by writing answer here.
e. implement this modification.
2. Given two river banks (visualization : two parallel lines), one bank has numbers written (1….n) in sorted order. On the other bank the numbers (1…n) are arranged randomly. A bridge can be formed from the ith point from bank 1 to ith point in bank 2. Find the max number of non-intersecting bridges you can form?
3. Given 1…n , and given some statements like i hates j, then find some arrangement of n numbers such that if i hates j then in the arrangement i comes before j. Say 1 hates 2, then 123456789 is acceptable but 213456789 is not.
4. Asked about internet. What happens when you type a URL on your browser?
Third Round (Hiring Manager):
1. Why do you want to leave current company?
2. Why do you think amazon is the right place for you?
3. Implement a calculator which takes a maths expression and evaluates it and prints the result.
4. Given statements like A is connected to B. D is connected to E. And transitive connections are allowed. Write a code which takes input such connected statements and and two numbers i and j and returns true if i and j are connected (can be transitively), and false if not connected.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.