Amazon Interview Experience | Set 159 (Off-Campus)

I recently got an offer from Amazon Delhi. Here goes my interview experience.

Telephonic Round
Q1. Find kth element from the end of a singly linked list.
Q2. Given an array (not sorted) of integers and a number S, find a pair in the array whose sum is equal to S. I gave the sorting solution and was asked to write the code for the sorting algorithm I used. I had used in-place merge sort.

F2F Delhi
1st round:
Q1. Detailed discussion on all possible data structures which can be used to implement a set with no duplicates and which supports add, delete and find operations in minimum space & time complexity. I suggested using hashing, BST or array. They asked me to give an example of a hash function which supports uniform distribution but is not collision free. Was asked to write codes for add, delete and find operations using BST.

2nd Round:
Q1. Rotate an image represented by a 2D matrix by 90 degree.
Q2. Given a singly linked list of 0s and 1s, sort it keeping the order intact. I gave O(N) time and O(1) space complexity solution.

3rd Round:
Q1. Discussion on projects and previous work.
Q2. Given stock prices of several days, find the two days so that buying the stock on 1 and selling it on another gives the maximum profit. O(N) time and O(1) space soln was expected.
Q3. Given a doubly linked list, reverse every 2 nodes. E.g. 1->2->3->4 will become 2->1->4->3
Q4. Several questions on OS, OOP, A few are what is segmentation fault, describe the design patterns you know.

4th Round:
This round was Bar-raiser round. A bit tricky.
Q1. Detailed discussion on projects, best project you have got, the most challenging work, strengths, weaknesses etc.
Q2. Given a dump of items sold in a file (not organized), give the top n items sold. Eg. the file looks like:
< item1 sold >
< item2 sold >
< item1 sold >
< item9 sold >
Also, there might be same items sold but they might have different names because of different vendors. So you also need to count them together (Hint: Use ids of the items).
Hint: Use grep command to get the counts.
Q3. Collect email-ids of all the persons above 18 yrs in a city. He wanted to see my way of thinking and how do I use software approach towards daily life problems.
Q4. There is a signal and two way traffic. Cars are coming @rate 10 cars/sec. Signal remains green/red for 10 secs and when the signal is green, 10 cars/min can cross the signal. You need to tell how many cars are in the line waiting behind the signal on both sides during a particular time. Say you run the simulator at time 0, now after 1 hour you need to tell the no. of cars waiting on both the sides.

I didn’t get selected after this but got a call after 1 month as they wanted to reconsider my profile.

F2F Hyderabad
1st Round:
Q1. Some discussion on previous work.
Q2. Given a sorted array S of characters say S= {‘a’,’d’,’g’}, you need to find the insertion point of a given character in it such that if it is less than ‘a’, insertion point is 0, if between ‘a’ and ‘d’, insertion point is 1 and if greater than ‘g’, again the insertion point should be 0. O(log n) time soln was expected.
Q3. Given a complete binary tree, connect nodes at the same level without using any extra space.
Q4. Given a dictionary of unknown language, you need to give the sorted sequence of characters in it.
E.g.
Dictionary looks like:
ABCDE
CF
DG
so the output may look like: ABCDEFG
Hint: Topological sort

2nd Round:
Q1. Given two arrays S1 and S2 of characters. You need to find the smallest length of substring in S1 which contains all the characters of S2. Characters need not be in the same order as in S2. Characters might be repeating in S1.
Q2. Given a dictionary like text file, find n top occurring words in it i.e. n words whose count is the maximum. Hint: Use Hashing and Min-Heap.

I would like to thank geeksforgeeks as it helped me a lot while preparing for the interviews.

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.