Recently I appeared in for off-campus Amazon Interviews for SDE position and here is my experience.
Round 1: 1 hour written test
Q1. Given a string you need to print all possible strings that can be made by placing spaces (zero or one) in between them. For example : ABC -> A BC, AB C, ABC, A B C
Q2. Given a tree where there are three pointers (left_pointer, right_pointer and a next_right_pointer). Left and right pointers are set like that of any general binary tree. We were asked to set the next_right_pointer to the next node in the level order traversal for the same level. This implies means for the last node in every level it will be null for rest it will be pointer to the next node in level order traversal.
Round 2: 1 hour technical
Q1. There is a 12 km road and a contractor who is in-charge of repairing it. Contractor updates you about the work which is done in patches. Like “Road between 3.2 km to 7.9 km repaired ”, “Road between 1.21 km to 3.2 km repaired”. You have a manager who enquires about the longest continuous patch so far. It was a long discussion and I gave solution in O(nlogn) where n is the number of updates by the contractor.
Q2. Several Questions were asked from my project.
Round 3: 1 hours 20 mins
Q1. There are billions and billions of stars and at any point of time you need to tell the closest million to earth. In what way I should take input for the stars and what all do I need to represent one. I used heap of a million size. Then he also asked about the different approach when I can’t use so much of physical memory for heap.
Q2. Implementation of Least Recently Used Cache. I started with O(n) solution using queue and ended up with O(1) solution using heap and doubly linked list.
Q3. Basically it was from snakes and ladders game. There is n x n matrix and you are at starting position. What is the no. of ways to reach n-square position if your next move will be dependent on number on dice? You have been given information about ladders (there are no snakes J ). I used DP.
There were few others that we didn’t discuss as I told him that I know solution to them.
Round 4: 1 hour
Q1. Write an efficient program to count number tree structures that can be made using n number of nodes.
Basically T(n)=summation (T(i) * T(n-i-1)). I used DP as there are a lot of sub-problems used again and again. O(n2) .
Q2. There are n nuts and n bolts represented in two different arrays and a function is_fit(nut_i, bolt_j) which returns 0 if its perfectly fit, 1 if it’s a tight fit and -1 if its loose fit. I was asked to arrange them so that every nut fits perfectly with the bolt in the same position (there is one nut for every bolt that fits perfectly). I suggested O(nlogn) solution.
Q3. Find the kth largest element in a BST. Well that was easy J
We discussed about projects and he asked reasons for leaving present company.
Round 5: 1 hour hiring manager round
Most of the questions were behavioral questions like dealing with manager in case of conflicts, reasons for leaving present company, why would you choose Amazon and not Flipkart if you have offers from both, about my projects and contribution to present company.
Round 6: Technical + Behavioral
Q1. How to know the time between someone writes Amazon.com and the page appears on his browser for a particular user. I impressed him by suggesting to use dummy request packets after the page is loaded completely sending the time J.
Q2. He showed me the Amazon page they were working at that time and I asked me to suggest 5 changes in 5 minutes.
Q3. Find the first circular tour that visits all petrol pumps
I messed up with the solution in the beginning but reached to solution eventually.
Many behavioral questions were asked too.
1. Don’t jump into solutions, ask about the type of input that is given and output that is expected.
2. The interviewer always tries to take you to the most optimal solution so listen to what all he says. Many a times they are big hints !!!
4. Keep believing that you will get the job J.
I would like to thank geeksforgeeks team for such an amazing platform to learn and discuss with other geeks.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.