I attended the Amazon Recruitment drive for freshers in Bangalore.
First 3 rounds were F2F pen-paper coding rounds of 45 mins each.
I was asked 3 questions in this round.
1)Trapping the Rain Water Problem
Suggested the solution by taking two arrays to store leftmax and rightmax for each element. Was asked to do it in constant space. I was able to do it by taking two pointers.
3. Print nodes at a distance k from a given node. As a follow-up, was asked to print the nodes in sorted order.
Two questions were asked in this round.
Given an n-ary tree, it consists of some bad nodes and good nodes. Nodes having value 1 are good and nodes with value 0 are bad. Problem was to count all root to leaf paths having less than K bad nodes.
Suggested a bottom up recursive approach. Interviewer was convinced but told me a top-down approach would have been an easier approach
2. LRU cache
This was again a problem solving round only and 4 questions were asked.
3) Find distance between leftmost leaf to rightmost leaf. I was told that by the interviewer that he will change the requirement and my code should be able to accommodate the changes.
Initially wrote a normal code counting the nodes from root to leftmost leaf and root to rightmost leaf. But he said he now wants to print the path. So wrote a recursive solution and interviewer was happy with the solution.
4) Find 3 numbers in an array such that their sum is closest to a given number X. Sum can be less OR more than X i.e absolute difference is to be considered.
After 3 rounds the HR told me that I had cleared all 3 rounds and 4th round will be a video call which will happen in a couple of weeks.
This was a Bar-raiser round and was taken by a senior person.
1) Initially was asked to introduce myself.
2) Then I was to explain my internship project and then a few counter questions over it.
3) Two problem-solving questions which I had to code on a code-pair sort of a platform wherein the interviewer was able to see my code. These were the two questions :
a) A variant of Merge k sorted arrays problem.
b) Delete all duplicate nodes in an unsorted linked list. Do this in one pass.
4) Why Amazon?
5) Did you ever face any issue in your internship project and how did you solve it?
With this round, the interview process was over. I got a call from the HR after a couple of days telling that the feedback was positive and I was hired 🙂
Thank you GeeksforGeeks for all the invaluable content. If you have solved enough problems on GeeksforGeeks, the interview should not be a problem at all.