Amazon SDE Interview Experience | On Campus 2019

• Last Updated : 05 Aug, 2019

Round 1:

The round 1 was an online coding round. There were 2 coding questions and 28 technical mcq’s to solved in 90 minutes. My coding questions were:-

1. There are n baskets containing apples. Input consists of a given array which represents number of apples in each basket. Find the minimum number of apples to be moved in order to make no. of apples in each basket equal.
2. A string is given as input. There is a particular format of a url. you have to convert the given string to url.               I don’t exactly remember the mcq’s but they were all on data structures and output questions in C and C++. I solved both the coding questions. Around 300 people sat for the online round and 24 were shortlisted.Some questions which came to my friends were:- Find the inversion count, evaluate a postfix expression, Dice Throw, smallest derangement, total decoding messages etc.

Round 2:

This was a face to face interview. the interview started with the normal question introduce yourself and then he said now we will do some coding. The first question he asked was, There is a hotel and there is a class reservation. Reservation class consists of user-id, check-in date, and check-out date. Find the day on which there are maximum users in the hotel. He wrote the function header in a paper and gave me. I t He then told him an approach by maintaining an array with index as day number. He then said to optimize the space complexity. I then told him a solution using sorting. He was satisfied. He told me to write the code.

The next question he asked was, given a binary tree with one more pointer called parent pointer which points to the parent node. Now a given any node of the tree, find it’s the first sibling. I first told him my approach, he said me too modularise it. I then wrote an recursive function for the same. then we discussed some edge cases. I was missing one edge case which I could’nt figure out. But he was satisfied so, he asked me the time complexity and the round was over.

https://www.geeksforgeeks.org/find-right-sibling-binary-tree-parent-pointers/

Round 3:

Round 3 started with a description of my internship. He asked me several questions about it like what technologies you used. Then he asked me how good I am at operating systems. I said I am not much good. He then explained to me the importance of OS. I was patiently listening to him. Then he told me to write the code for drawing a circle given radius and assume center as 0, 0. I told him a method using sin and cos. He then told me if i can do something else. Then I told him another mathematical approach which included floating-point calculations. He told me to remove that. I then derived two conditions using which we can decide the next point. He was a bit satisfied. Then he told me the round was over. I was a little bit confused whether I will qualify or not, but I did.

Round 4:

This was round was taken by an SDE2. He told me to consider there are multiple packages and every package is dependent on some or none. For a particular package to be built, what is the optimal order in which the packages should be build.  The answer is to use consider it as a graph and then use Topological Sorting. I told him Topological sort. He then told me to write the code for the same. After some discussions with him, I wrote a proper code for it.

The next question was Spiral Order Traversal of a Binary Tree. I first told him an approach by using more space. He then told me to optimize it. I then told him the solution using two stacks. He told me to write the code for it.