Open In App

Amazon Interview Experience for SDE Internship(On-Campus)

Improve
Improve
Like Article
Like
Save
Share
Report

Amazon Online assessment. So this round was held on the platform called AMCAT. The questions were repetitive and most of the things that were asked were available on the Internet.

So this round had 4 Parts:

  1. Debugging
  2. Aptitude
  3. Behavioral
  4. Coding

The coding round was pretty simple, some questions that I encountered were:-

  1. Create a copy of the Linked List containing Random Pointers.
  2. Search in a matrix that is sorted Row -Column wise.
  3. Bridge in a graph.
  4. https://leetcode.com/discuss/interview-question/373006

All the questions were easily available on the Internet.  

Technical Interview 1: Approx 2500 people gave the first online round and only 161 students got the opportunity for the interview. So my interview was held after a week of the declaration of the online round result.

I joined the meeting on Amazon chime, interviewer directly asked me to join the live coding platform on which he gave me my first coding question.

He told me to tell him an optimal approach, and only if he will be satisfied with my approach, I will be allowed to write the code. I told him my approach, although he gave some hints to get me to the right approach.

Question 1: Given array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of the target.  

Notice that the solution set must not contain duplicate quadruplets.

Input: nums = {1,0,-1,0,-2,2}, target = 0
Output: [[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]

It was based on DP on trees, the first approach that I told him was a brute force approach, He wanted me to do this in O(N) so within 4-5 mins, I was able to figure out a solution. So I had to code these in 45 – 60 mins including the discussion on the approach and time complexity.  

It was an amazing experience overall I faced these problems for the first time, and I was almost able to get it right. It was an amazing feeling, Super Satisfactory.

Question 2: Given the root of a binary tree, find the maximum value V for which there exist different nodes A and B where V = |A.val – B.val| and A is an ancestor of B.

    8
   / \
  3   10
 /  \   \
1    6   14
    /  \   \
   4    7   13

Technical Interview 2: This was a great round though I was not able to perform well. The interviewer was very friendly and was just observing what I was thinking while approaching the question.

So in this round too he directly asked me to join the live coding platform. Then he gave me one question to solve, I asked him whether he wants to hear my approach to which his reply was NO,  

He told me that he is excited to see how I will approach the problem. In this round he wasn’t even expecting a proper code without bugs he was only interested in knowing my thought process and how I approach the problem.

Question 1: You are given a string of numbers, You have to return a partitioned String Array in which substring (i-1)th +(i-2)th = ith substring.  

If not possible return an empty string array.

For example:

Input:                  Output:
"111122335"   ------>   {"1","11","12","23","35"}  
Input:                  Output:
"112233"      ------->  {"11","22","33"}
Input:                  Output:
"11314"       ------->  {"11","3","14"} or {"1","13","14"}
Input:                  Output:
"13234113"     -------->{}

So I gave a Backtracking solution for the first question. The time complexity was high and I wasn’t able to reduce it(Though I coded the backtracking solution correctly).

Question 2:

B, C, D reports to A
E, F, G reports to B
H, I report to C
J, K, L reports to H
M, N reports to K
O, P reports to J
Input:
Emp1: O
Emp2: M
Output:
C

This was the second question nothing else was given. I had to figure out what I have to do with this.

He told me that I have to design a Data structure to hold all this information and make a proper program to show how I was going to store values in the Data Structure.

After that solve the question for the given input.

In place of A, B, C, D…etc there can be a Unique ID for each employee and there can be unlimited people reporting to one person. For the second question, I build an N-Ary Tree for the solution, basically, the output was the Least Common Ancestor of the input values.

So I made a program for the whole structure with whole Input and Output (Including how I will put the given data into the Data Structure).  

I wasn’t able to reduce to time complexity of the solution he asked me to solve this in O(1) or O(N).


Last Updated : 27 Nov, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads