Amazon interview experience Real time questions & tips from candidates to crack your interview

SDE - Intern

Amazon
upvote
share-icon
3 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Journey
I started preparing for my placement from the starting of the B.Tech. Getting into one of MNCs in India was my dream, and I researched about it a lot like What are the most essential topics fro FAANG Interview?, How should you approach your graduation if you want to make it count?, etc. I practised DSA continuously for three years, and I thought I had a great base for them but at last I was not selected into any of companies in FAANG. But I still tried to get into them some day, and then, after 2 years of completing my graduation I got this opportunity.
Application story
I saw this opportunity on the amazon company websites. I was curious about it from the very start as getting to any of those giants of the industry was my dream. After few days I got a mail from the HR about the selection of my resume for the interview and the interview process.
Why selected/rejected for the role?
I think I was on point with my coding solutions to the questions asked in the interviews. I provided the optimal solutions and I was giving correct explanations to some theory questions asked.
Preparation
Duration: 4 months
Topics: Data Structures and Algorithms, OOPS, DBMS, Computer Networks, Operating System
Tip
Tip

Tip 1 : Practice questions from all the topics as much as possible
Tip 2 : Be very much attentive while doing projects in college or anywhere, they are asked in detail if mentioned in resume.
Tip 3 : Be consistent while practicing and do a variety of questions rather than doing more questions of same kind.

Application process
Where: Company Website
Eligibility: Above 6.5 CGPA, No backlogs
Resume Tip
Resume tip

Tip 1 : You should know whatever you have mentioned in your resume. Don't brag in your resume ever. Be very precise. It doesn't matter how much you have done, what matters is you are very much confident and clear about what you have done.
Tip 2 : Put your projects and the language you code in for sure in your resume.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 minutes
Interview date22 May 2020
Coding problem2

This was an online technical round on the mettl platform, the test window was open from 22 to 25 May 2020
The test had 28 mcqs and 2 coding questions.
The test was proctored. One needed to have webcam on.
A sample test link was provided before test to get familiar with the mettl platform.

1. Count inversions

Moderate
40m average time
55% success
0/80
Asked in companies
Hewlett Packard EnterpriseBNY MellonGrab

For a given integer array/list 'ARR' of size 'N' containing all distinct values, find the total number of 'Inversions' that may exist.

An inversion is defined for a pair of integers in the array/list when the following two conditions are met.

A pair ('ARR[i]', 'ARR[j]') is said to be an inversion when:

1. 'ARR[i] > 'ARR[j]' 
2. 'i' < 'j'

Where 'i' and 'j' denote the indices ranging from [0, 'N').
Problem approach

Brute Force Approach got submitted.
Approach:
I used and O(n^2) approach, where I used 2 for loops.
step1 : First loop was from index 0 to sizeof given array i.e. i
step2 : inside this was another loop from index of first loop + 1 to the end of array i.e. j.
step3 : If the value of array[i]>array[j] add 1 to the count of inversions.
Then return count of inversions at the end of both the for loops.

Try solving now

2. Find pair with maximum GCD in an array

Moderate
35m average time
75% success
0/80
Asked in companies
PhonePeAmazonVisa

You are given an array of positive integers. Find the GCD(Greatest Common Divisor) of a pair of elements such that it is maximum among all possible pairs. GCD(a, b) is the maximum number x such that both a and b are divisible by x.

For example: 
If the given array is {1, 5, 2, 3, 4}, the output will be 2 (which is GCD of 2 and 4, all other pairs have a GCD of 1)
Problem approach

I used simple approach to solve this problem.
Step1 : First of all make a GCD function using Euclidean Algorithm. O(NlogN)
Step2 : Then using two nested for loops find gcd of all the possible pair of the array and find their gcd and return the maximum of all gcd.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date1 Jul 2020
Coding problem3

Time : 12pm to 1pm
Mode of Interview : Amazon Chime Video
LiveCode : To write code, it was not a compiler
The interviewer was quite supportive.

1. Array Queries

Given an array A( all 0 values initially) of size n, given q queries(query eg1: start = i, end =j)(here start and end are index such that you have to add 1 from start index to end index in array A). Return the array A after performing q queries.eg : size of array = 10queries:q1 = 5 8q2 = 6 8output = 0 0 0 0 0 1 2 2 2 0

Problem approach

For a query q(a,b):
Step 1 : I added 1 in the array at the starting index of the given query ( that is the left boundary of given range).
for the ending index (that is the right boundary of the range) I subtracted 1 from the value present at index b+1. if b+1 is a valid index of the given.
Step 2 : Repeat the same process for all the given queries and at the end find cumulative sum of the array an that means
for (int i=1 to size of array)
array[i] = array[i-1]
Step 3 : Return the resulting array.

2. Majority element

Easy
15m average time
85% success
0/40
Asked in companies
AmazonInfo Edge India (Naukri.com)HCL Technologies

You have been given an array/list 'ARR' consisting of 'N' integers. Your task is to find the majority element in the array. If there is no majority element present, print -1.

Note:
A majority element is an element that occurs more than floor('N' / 2) times in the array.
Problem approach

Return Middle element of the array that is return A[n/2].

Try solving now

3. Subarray with equal occurrences

Moderate
15m average time
80% success
0/80
Asked in companies
AmazonAmdocs

You have been given an array/list ARR of length N consisting of 0s and 1s only. Your task is to find the number of subarrays(non-empty) in which the number of 0s and 1s are equal.

Problem approach

1)Consider all 0’s in arr[] as -1.
2)Create a hash table that holds the count of each sum[i] value, where sum[i] = sum(arr[0]+..+arr[i]), for i = 0 to n-1.
3)Now start calculating cumulative sum and then we get increment count by 1 for that sum represented as index in the hash table. Sub-array by each pair of positions with same value of cumulative sum constitute a continuous range with equal number of 1’s and 0’s.
4)Now traverse the hash table and get the frequency of each element in the hash table. Let frequency be denoted as freq. For each freq > 1 we can choose any two pair of indices of sub-array by (freq * (freq – 1)) / 2 number of ways . 5)Do the same for all freq and sum up the result that will be the number all possible sub-arrays containing equal number of 1’s and 0’s.

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date12 Jul 2020
Coding problem2

Time : 11 am to 12am
Mode of Interview : Amazon Chime Video
LiveCode : To write code, it was not a compiler
The interviewer was quite supportive.

1. Sorted linked list to balanced BST

Moderate
25m average time
70% success
0/80
Asked in companies
AppleRed HatMicrosoft

You have been given a singly linked list in which nodes are present in increasing order. Your task is to construct a Balanced Binary Search Tree with the same data elements as the given Linked List.

A Balanced BST is defined as a BST in which the height of two subtrees of every node differs no more than 1.

Problem approach

I solved this problem with the very first approach that can come to anyone's mind.
That is using recursion
Step 1 : Make a separate function to find middle element of a list using runner technique.
Step 2 : Find middle element of the list and make it the root of the bst and pass the left part of middle node of the list in the function to return the left node of the current node of bst and right part to get the right child subtree of the current node of bst.
Step 3 : Return root of bst.

Try solving now

2. Implement Stack with Linked List

Moderate
30m average time
73% success
0/80
Asked in companies
AmazonMathworksDell Technologies

You must implement the Stack data structure using a Singly Linked List.


Create a class named 'Stack' which supports the following operations(all in O(1) time):


getSize: Returns an integer. Gets the current size of the stack

isEmpty: Returns a boolean. Gets whether the stack is empty

push: Returns nothing. Accepts an integer. Puts that integer at the top of the stack

pop: Returns nothing. Removes the top element of the stack. It does nothing if the stack is empty.

getTop: Returns an integer. Gets the top element of the stack. Returns -1 if the stack is empty
Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by Amazon
2163 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Amazon
1068 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
1043 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3502 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15499 views
1 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
8187 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Microsoft
4914 views
2 comments
0 upvotes