Amazon Interview Experience | Set 176 (For SDE 1)

Telephonic Round 1:
1) You are given an integer array. Create a Binary Search Tree from it.
2) You are given a Binary Search Tree. Write an algorithm to print the Path Array of a given key.
PATH ARRAY:
a) If the given key is not present in the tree than the Path Array is equal to “-1”
b) If the given key is present in the BST, path array tells you the path (in terms of left & right direction) that you take from root to reach the given key. If you go towards right add “0” to the path array and if you go towards left add “1” to Path Array.

Telephonic Round 2:
1) You are given an array as an input. The array is organized in such a way that its element are arranged in increasing order up till a certain index and in decreasing order after that. Write an algorithm to search an element in such a array.

Face To Face 1:
1) You are given two array of “n” length. First array contains the arrival time of various trains on a particular station. Second array contains the departure time of those trains. Write an algorithm to find out the minimum number of platforms that will be required to accommodate all the trains.

2) You are given a binary tree. A light source is placed on the right of the tree. Print the list of all the nodes over which the light is falling directly.

Face To Face 2:
1) A new feature is to be implemented in Kindle. FEATURE : The user inputs the no. of days in which he would like to complete a particular book and the Kindle will create a reading plan for the user.
Write an algorithm which will output the reading plan to the user. The reading plan should be created keeping in mind that the user would like to begin and end reading a particular “chapter” of the book on the same day.
2) Some general questions:
a) Tell a project where you had faced tight deadlines and you had to skip a few things.
b) How did you decide, which things should be skipped?
c) If given a chance to implement the same project again, how will you implement it?
I gave all the answers with respect to a college project.

Face To Face 3:
1) A very brief discussion of what my current responsibilities are. It was a 5-10 minutes discussion only. I feel that the discussion was brief as my experience was just a little over 1 year.
2) Given a binary tree write an algorithm for spiral traversal of the tree.

3) You have N documents, where N is very large. Each document has a set of words lets say w1,w2..wm where m might differ for each document. Now you are given a list to K words lets say q1,q2…qk.
Write an algorithm to print the list of document which have the K words in them.

This question required a number of hints. I finally came up with the solution of creating a combined trie for all the documents. After listening to my solution he said that it was good but could have been better with B-Tree. I told that as of now I am not able to memorize the concept of B-Tree and he said he was satisfied with the trie solution that I had given.

Face To Face 4:
1)
a) What are various types of tree traversals and diff between them?
b) Which of the traversals would you require for creating the tree (unique) back?
2) You have a very large array, but the array can contain only three elements: 0,1& 2. Write an algorithm to sort the array.
Count Sort was one option, but it didn’t strike to me at that point of time. So I came up with a trivial algorithm which sorts by putting all the 2’s to the right and all the 0’s to the left, 1’s get sorted by themselves.

For all the questions in all the interviews I was asked for the time complexity of the problems. However they didn’t expected me to do some calculation and then come up with a very tight bound solution. They just wanted a rough estimate of the time complexity of the solutions.

Allocated time for all the interviews was 1 hour.

I would like to thank GeeksForGeeks for helping me with the preparations.

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.


Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.