Open In App

Amazon Interview Experience | SDE Intern

Improve
Improve
Like Article
Like
Save
Share
Report

Internship – 6 Months Off Campus December 2019

Round 1:

It was an online test at Mettl. It consisted of 28 MCQs based on Data structures and algorithms and some output based questions. Difficulty:- Medium to High

It also had two programming questions:-

  1. Dice Throw Problem
    https://www.geeksforgeeks.org/dice-throw-dp-30/
  2. Given an unsigned 32 bit integer, find  a) leftmost signed bit b) rightmost signed bit c) the total number of signed bits.We have two return a character array containing a#b#c

I was able to solve both questions. After about 7 days, I received a message that I had cleared the test and was called for an interview a week later.

Round 2:

It was a Face to Face round. The interviewer was friendly. Started off by asking technical introduction, whether I have done any internships or not. Then he jumped right into DS and algorithms.
I was asked two questions in this round and was asked to write code for the same.

  1. Iterative PostOrder Traversal Of a Binary Tree.  (The interviewer specifically asked me to use only one stack)
    https://www.geeksforgeeks.org/iterative-postorder-traversal-using-stack/
  2. Printing the maximum length increasing subsequence(length and subsequence both)
    He expected the optimized form but I could only write code for  O(n^2) approach. I just mentioned about Patience sorting algorithm which can solve this problem in O(N log N) time.

After this question, he asked me whether I have any questions for him. After discussing, he asked me to wait for the result. The HR came and told me that I have to wait for the second round. After about 40 minutes, I was called for the second round.

Round 3:

The interviewer didn’t waste any time and jumped right into DS and algorithms. No questions from resume were asked in this round.
I was asked the following questions:-

  1.  Given an array of n elements, it should satisfy the following property a < b > c < d > e < f > g 
    I observed that elements at even indices must be lesser than their neighbors while elements at odd indices must be greater. I told him a naive approach of O(N log N)
    We could put elements in a maxHeap and then first one by one pop and fill the odd indices first and then the even indices. He wasn’t satisfied with the complexity.
    He wanted O(n) time complexity solution. After thinking for about 5 minutes, I asked him for a hint. (He said bubble sort). I was also thinking about swapping
    adjacent elements and got the green signal once I heard this from him.  I told him that if the current element doesn’t satisfy the rules, we swap it with the next element.
    I wrote the code for it and he went through some examples. He was satisfied and moved to the next question.
  2.  He asked me to implement an LRU cache (Indirectly)
    https://www.geeksforgeeks.org/lru-cache-implementation/
    He asked me to implement the mechanism for obtaining three recently played videos for a user such that if a user plays a new video and that is not in the recently played list, the earliest one is removed from this list and this became the latest one. I at once told him that this seems like an LRU cache. He asked me which data structure I would use to solve this problem.
    I told him an unordered map with a doubly-linked list. He asked what the map and list would store. After discussing the approach,   he asked me to write the code for the insert function.
    After I wrote the code, he asked since you have specifically used doubly-linked lists write delete function for a doubly-linked list, given a node pointer.
  3. Given a pointer to a Doubly Linked List Node, delete the node.
    https://www.geeksforgeeks.org/delete-a-node-in-a-doubly-linked-list/
    I wrote the code and he asked me to run through some edge cases. The code was correct so he quickly moved on to the next question.
  4.  Design a custom data structure that supports insert, search, delete and getRandom operation in O(1) time.
    https://www.geeksforgeeks.org/design-a-data-structure-that-supports-insert-delete-search-and-getrandom-in-constant-time/
    I took some time to think of the approach and gave the approach to him. He even helped me when I got stuck. I told him that an unordered map and a variable-sized array would be good.
    He asked me to write the code for the delete function.  I wrote the code and he asked me if I am making any mistake. I looked again and found a mistake. I corrected it and then he was satisfied.
  5.  Given a matrix of 0 and X, where 0 represents water and X represents land, find the maximum size of the continuous island. I told him that I would do this by using BFS.
    He asked me what Ii will store in the queue and how I will maintain the size of the island. I didn’t have to write the code for this. He was satisfied just after listening to the approach.After this, he asked me if I had any questions for him. I asked him some questions about work at Amazon. We discussed for about 10-15 minutes and then he said that the interview was over. I knew that this was the last round. The HR told me that they would mail me the result and I shook hands with the interviews before leaving. I got the mail that I am selected as an intern just one day after the Interview.

    Tip:- Whenever stuck, try discussing the interviewer what you are thinking of and where are you stuck. I got stuck in Question 4 in round 2 in between using a linked list or array. He asked me to focus on the array approach.  When that fails, don’t shy to ask for a hint. The interviewer will give you a slight hint and you can build upon that.

    Verdict: SELECTED!!!


Last Updated : 17 Dec, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads