Amazon Job Interview experience – My Dream Job

Hi, I joined Amazon in 2014 after my graduation. It was a marathon 2 day experience which included 3 initial screening rounds ( 1 MCQ round + 2 online test round) on the 1st day followed by 4 personal interviews on the 2nd day.

It’s been close to 6 years now for me working at Amazon. During this period of lockdown, I thought it would be great to relive that experience once again.

In this post, I have described my interview experience (to the best I remember).

MCQ round(Time) : 45 minutes 20 Objective Questions:

This was the first round in which close to 150 students participated.
Questions included wide range of topics and tested the fundamental computer science knowledge.

These topics included basic math and probability, determining output of a code snippet. There were questions on data structures like heap, tree, hashing and algorithms like FCFS, round robin scheduling, page fault in demand paging, dining-philosopher problem and Huffman code. Some other topics included SQL query, time complexity and recursion.

Online test 1 (Time): 45 Minutes

Q1: Given three linked lists,where each linked list represents a number, add the three lists and return the resultant list.

5->1->2->NULL
9->1->NULL
7->2->2->NULL
Output :: 1->3->2->5->NULL

Q2: Given an array and two numbers x and y, find minimum distance between two numbers x and y. Assume that x and y always exist in array and it may be that x and y are same also.

Online test 2 (Time): 45 Minutes

Q1: Convert a given binary tree to sum tree.

Q2: Given an array consisting of both positive and negative numbers, 0 is considered as positive, rearrange the elements such that positive and negative numbers are placed alternatively, constraints are that it should be in-place and order of elements should not change.

Interview Round 1 (75 Minutes):

Q1: Given a linked list, reverse every k nodes of the linked list.
Q2: Given a matrix of size m * n, place k students in such a way so that cheating in an exam could be minimized…. Was asked to just explain the approach, no code required.
Q3: Suppose a online chat between customer and serviceman, serviceman wants to reply to customer asap. Suppose text which is to be sent as reply takes 10 sec for being typed. How can he make typing faster ?

My answer was using auto prediction feature, by which he will need to type less number of characters, so typing will become faster.
Then question was extended to how to store the words for being used in prediction.

I answered a Trie data structure which allows prefix matching..
Then question was further extended to write a code to traverse all the words stored in dictionary in lexicographic order..

Interview Round 2 (60 Minutes):

Q1: First of all was asked to tell something about myself.
Q2: A detailed discussion about the project, conversation continued nearly for 20 minutes, he wanted me to explain him everything from the scratch. I used genetic algorithm in my project. So he wanted me to explain him the concept of genetic algorithm.
Q3: You are given prices of stock of a company at consecutive days in an array..write a code to find the maximum profit one can make by keeping a stock value for as long as possible, that value of a stock is called a stable stock value.

Example:
6 5 9 8 3
So maximum profit is 15, because stock of value 5 would be hold for 3 days. So max profit is 15.


The problem basically was a variation of finding index of next smaller element. I solved it using the concept of largest rectangular area in a histogram where need to keep track of previous smaller will not be required.

Interview Round 3 (60-75 Minutes):

Interviewer was very cool. He first asked about me, did some casual talk to do away with my nervousness.

In fact, he told me that it looks like that you all have studied geeks for geeks very thoroughly so I am going to ask you a question that is not present in geeks for geeks. He challenged me it will be a question you have not heard of before. At the end of round, he showed me it was a question from top coder, but I had never heard of anything called top coder before.

Q1: Given a string, find the longest sinusoidal sequence in it. If there are multiple such sequences of same maximum length, return the one which comes first in lexicographic order in a dictionary..
Sinusoidal means increasing then decreasing then increasing and so on.

Example :
a r u n :
a u n , a r n , r u n are three such sequences of length 3 but a r n is output since it comes first in lexicographic order.


Interviewer gave me hints that if I had to found the sequence in which all elements were increasing, then I answered Longest Increasing Subsequence (LIS) will give me the solution , this was the hint. So, basically, it was a variation of LIS. I answered it in O(n2) and 2n space….
Then was asked to do it in (n) space and o(n) time complexity.

Q2: Suppose a student needs to implement a BST structure to solve a problem, but instead he used a linked list. Then give an example of input sequence, in which his implementation works.

New value will always be added at beginning of a linked list. So, basically at each step after insertion, root of BST and head of link list should point to same node. I was asked to provide the sequence.

Interview Round 4 ( 35 Minutes)

This round started of with some nontechnical questions.. This included a range of questions related to hypothetical situations and my approach in those situations.

They seemed to have found out every detail of terms involved in my project. So, there was a detailed discussion on project. My project involved concepts of statistics, so he asked me questions regarding stats. This discussion went nearly for half an hour. In the end, he told me lets see whether your project could bring you to amazon.

After the 4th round, I nearly had to wait for 4 hours before the results were announced. Finally, the interviewer said they were highly impressed by me and I was hired.

In total 7 students were selected among us.

 

Leave a Reply

Your email address will not be published. Required fields are marked *