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

SDE - Intern

Amazon
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures and Algorithm, Operating Systems, DBMS, Oops Concepts, Hashing, Computer Networks
Tip
Tip

Tip 1 : You should have excellent problem solving skills 
Tip 2 : Code a lot.
Tip 3 : You should be thorough with your concepts of Data Structures and Algorithm. 
Tip 4 : Know the complexities of the code that you’ve written.

Application process
Where: Campus
Eligibility: Above 6.5 CGPA
Resume Tip
Resume tip

Tip 1 : Mention your important projects in detail
Tip 2 : Keep it precise and concise

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date20 May 2020
Coding problem2

The online test consists of around 28 MCQs and 2 programming questions.

1. Check Subset

Easy
18m average time
90% success
0/40
Asked in companies
QualcommAmazonMedia.net

You are given two integer arrays ARR1 and ARR2 of length N and M respectively. You have to return true if ARR2 is a subset of ARR1, otherwise, return false.

For Example:

If the given arrays are [1, 2, 3] and [1, 2] then you need to return true as ARR2 is a subset of ARR1, but if the given arrays are [1, 2, 3] and [1, 2, 2] then you need to return false since ARR2 is not a subset of ARR1.
Try solving now

2. Kth Smallest and Largest Element of Array

Easy
15m average time
70% success
0/40
Asked in companies
HSBCSalesforceTech Mahindra

You are given an array ‘Arr’ consisting of ‘N’ distinct integers and a positive integer ‘K’. Find out Kth smallest and Kth largest element of the array. It is guaranteed that K is not greater than the size of the array.

Example:

Let ‘N’ = 4,  ‘Arr’ be [1, 2, 5, 4] and ‘K’ = 3.  
then the elements of this array in ascending order is [1, 2, 4, 5].  Clearly, the 3rd smallest and largest element of this array is 4 and 2 respectively.
Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date27 Jun 2020
Coding problem2

It was scheduled a week in advance. The interviewer was very kind and helpful.

1. Longest Path

Moderate
25m average time
65% success
0/80
Asked in companies
PhonePeAmazonWinZO

You are given a Directed Acyclic Graph (DAG) with ‘E’ edges and ‘V’ vertices. A DAG is a type of graph with no directed cycles.

You have been given a source vertex ‘S’. Your task is to find the distance between ‘S’ and the farthest vertex reachable from ‘S’?

Example: Given a DAG graph :

Source node: 1
The farthest vertex in the above graph from vertex 1 is 2 via the route of vertex 3. So, the distance is 2.
Problem approach

It was a basic tree question. In my solution I used a global variable so the interviewer asked me to write a code where I am using the variable as an argument to the function.

Try solving now

2. LRU Cache Implementation

Moderate
25m average time
65% success
0/80
Asked in companies
Tata 1mgPaytm (One97 Communications Limited)Wells Fargo

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.

2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
You will be given ‘Q’ queries. Each query will belong to one of these two types:
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
Note :
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).

2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
Problem approach

I used a vector and map.

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date11 Jul 2020
Coding problem1

The round consisted of 1 coding question and few c++ and oops concepts were asked.

1. String Transformation

Moderate
23m average time
0/80
Asked in companies
WalmartSprinklrAccenture

Given a string (STR) of length N, you have to create a new string by performing the following operation:

Take the smallest character from the first 'K' characters of STR, remove it from STR and append it to the new string.

You have to perform this operation until STR is empty.

 Note:
The input string(STR) will not contain any spaces.

Assume that all characters in STR are lower case letters.

If characters less than 'K' remain, then append them in a sorted way to the new string.
Example:
Let the input string be "edcba" with K = 4.

Let the new string to be formed is initially empty, newString = "".
The first set of 4 characters are, ('e', 'd', 'c', 'b')
Out of these 4 characters, the smallest one is 'b' and hence we add it to the newString and it becomes, 
newString = "b"

The next set of 4 characters are, ('e', 'd', 'c', 'a')
Out of these 4 characters, the smallest one is 'a' and hence we add it to the newString and it becomes, 
newString = "ba"

Now we are left with "edc" and since we can't get a window of size 4, we sort them in the increasing order and append them to the newString.

Hence, newString thus formed will be "bacde".
Problem approach

I used a recursive method

Try solving now
04
Round
Medium
Video Call
Duration60 minutes
Interview date25 Jul 2020
Coding problem2

I was asked 2 questions in this round along with some core concepts. This was my last round.

1. Sorted Linked List to Balanced BST

Moderate
25m average time
70% success
0/80
Asked in companies
AppleGoogleRed Hat

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

It is a standard question.

Try solving now

2. Delete mid element from stack

Easy
15m average time
85% success
0/40
Asked in companies
AmazonTech MahindraGroww

You are having a stack "ARR" of size 'N+1', your task is to delete the middlemost element so that the size of resulting stack is 'N'.

A stack is a linear data structure where both insertion and deletion of elements take place at the top. It follows FILO (First In Last Out) or LIFO (Last In First Out) approaches. Books piled on top of each other is an example of a stack, where you can only remove a single book at a time, which is at the top of the stack. Likewise, you can only add a single book at a time, on the top of the stack only.

Example :-
INPUT : ARR [ ] = [ 1 , 2 , 3 , 4 , 5 ] , N = 4
OUTPUT: ARR [ ] = [ 1 , 2 , 4,  5 ]

The above example contains an odd number of elements, hence the middle element is clearly the (N+1) / 2th element, which is removed from the stack in the output.

INPUT : ARR [ ] = [ 5, 6, 7, 8 ] , N = 3
OUTPUT: ARR [ ] = [ 5, 7, 8 ]

The above example contains an even number of elements, so out of the two middle elements, we consider the one which occurs first. Hence, the middle element would be ((N+1) / 2 - 1) element, which is 6 and is removed from the stack in the output.
Problem approach

I used a recursive approach.

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

What does print(2 ** 3) output in Python?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by Amazon
1313 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Amazon
508 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
527 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
1049 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
12861 views
1 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
7542 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Google
5376 views
1 comments
0 upvotes