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

SDE - Intern

Amazon
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Journey
I first learned a programming language in my first year. Then, I practiced DSA from various platforms like Leetcode, GFG, etc. Leetcode is one of the best platforms to practise a wide variety of questions. For other subjects like OS, CN, DBMS etc, I prepared it from my college subjects only.
Application story
I saw openings on Amazon portal for this position. So, I reached out to a lot of Amazon employees on LinkedIn for referral. One of the employees agreed to give me referral. So, I applied through his referral.
Why selected/rejected for the role?
My main reason of rejection was lack of in-depth knowledge of advanced DSA topics like Trees. I hadn't prepared Trees very well , so I wasn't able to give optimised approaches for Tree based questions.
Preparation
Duration: 2 months
Topics: Data Structures, OOPS, Operating Systems, Algorithms, C
Tip
Tip

Tip 1 : Code More
Tip 2 : Study Data Structures
Tip 3 : Be Confident

Application process
Where: Referral
Eligibility: 6.5 CGPA
Resume Tip
Resume tip

Tip 1 : Mention only what you are confident about
Tip 2 : Mention tools & technologies used in the project as well

Interview rounds

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

25 mcqs and 2 coding questions
(It was a part of Amazewow process via Amazewit https://www.amazewit.in/)
Timing- any time between 22-24 may 2020
Webcam was on.

1. Longest Decreasing Subsequence

Moderate
35m average time
60% success
0/80
Asked in companies
AmazonThought WorksFlipkart

You are given an array/list ARR consisting of N integers. Your task is to find the length of the longest decreasing subsequence.

A subsequence is a sequence of numbers obtained by deleting zero or more elements from the array/list, keeping the relative positions of elements same as it was in the initial sequence. A decreasing subsequence is a subsequence in which every element is strictly less than the previous number.

Note:

There can be more than one subsequences with the longest length.
For example:-
For the given array [5, 0, 3, 2, 9], the longest decreasing subsequence is of length 3, i.e. [5, 3, 2]
Note:
Try to solve the problem in O(N log N) time complexity.
Problem approach

I first thought of the brute force approach.
Then tried to solve for LIS which I had already solved once.
Then implemented the approach of DP for LDS.

Try solving now

2. Next Greater Element

Moderate
20m average time
90% success
0/80
Asked in companies
PayPalSamsungDunzo

You are given an array arr of length N. You have to return a list of integers containing the NGE(next greater element) of each element of the given array. The NGE for an element X is the first greater element on the right side of X in the array. Elements for which no greater element exists, consider the NGE as -1.

For Example :

If the given array is [1, 3, 2], then you need to return [3, -1, -1]. Because for 1, 3 is the next greater element, for 3 it does not have any greater number to its right, and similarly for 2.
Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date30 Jun 2020
Coding problem2

It held at morning 10 AM.
The interviewer was very friendly.
I was asked to solve 2 coding questions and was continuously provided with hints by the interviewer.
Question was on Array and Trees.

1. Ninja And The Rows

Easy
15m average time
87% success
0/40
Asked in companies
AdobeAppleLTI - Larsen & Toubro Infotech

Ninja has been provided a matrix 'MAT' of size 'N X M' where 'M' is the number of columns in the matrix, and 'N' is the number of rows.

The weight of the particular row is the sum of all elements in it. Ninja wants to find the maximum weight amongst all the rows.

Your task is to help the ninja find the maximum weight amongst all the rows.

EXAMPLE:
Input: 'N' = 2, 'M' = 3, 'MAT' = [[1, 2, 3], [2, 0, 0]]
Output: 6

The weight of first row is 1 + 2 + 3 = 6
The weight of the second row is 2 + 0 + 0 = 2; hence the answer will be a maximum of 2 and 6, which is 6.
Problem approach

I first thought of the brute force approach using 2 for loops.
Then I thought of using a Stack.
Then by using a heap.
Finally, I was able to code it using 2 additional arrays (max and min).
it took O(n) time complexity and O(n2) space complexity.

Edge Case: For the first student, there is no lighter student in front but we only have to consider heavy students for him.
Similarly, for the last student, only the lighter student will be checked.

 

Try solving now

2. Convert Bst To The Greater Sum Tree

Moderate
30m average time
70% success
0/80
Asked in companies
AmazonMathworksCultfit

You have been given a Binary Search Tree of integers. You are supposed to convert it to a greater sum tree such that the value of every node in the given BST is replaced with the sum of the values of all the nodes which are greater than the value of the current node in the tree.

A Binary Search Tree is a tree, whose internal nodes each store a value greater than all the values in the node's left subtree and less than those in its right subtree.

Note :

You need to modify the given tree only. You are not allowed to create a new tree.
For example:
For the given binary search tree

Example

11 will be replaced by {15 + 29 + 35 + 40}, i.e. 119.
2 will be replaced by {7 + 11 + 15 + 29 + 35 + 40}, i.e. 137.
29 will be replaced by {35 + 40}, i.e. 75.
1 will be replaced by {2 + 7 + 11 + 15 + 29 + 35 + 40}, i.e. 139.
7 will be replaced by {11 + 15 + 29 + 35 + 40}, i.e. 130.
15 will be replaced by {15 + 29 + 35 + 40}, i.e. 104.
40 will be replaced by 0 {as there is no node with a value greater than 40}.
35 will be replaced by {40}, i.e. 40.
Problem approach

First I wrote the post order traversal of input,
Then by simply doing post-order traversal and performing swapping in between.

Try solving now
03
Round
Hard
Video Call
Duration45 minutes
Interview date10 Jul 2020
Coding problem2

Morning 8 AM.
The interviewer was very friendly provided with various hints.
It was covering complex coding questions on Tree Data Structures.

1. Time to Burn Tree

Hard
50m average time
50% success
0/120
Asked in companies
SprinklrShareChatZomato

You have a binary tree of 'N' unique nodes and a Start node from where the tree will start to burn. Given that the Start node will always exist in the tree, your task is to print the time (in minutes) that it will take to burn the whole tree.


It is given that it takes 1 minute for the fire to travel from the burning node to its adjacent node and burn down the adjacent node.


For Example :
For the given binary tree: [1, 2, 3, -1, -1, 4, 5, -1, -1, -1, -1]
Start Node: 3

    1
   / \
  2   3
     / \
    4   5

Output: 2

Explanation :
In the zeroth minute, Node 3 will start to burn.

After one minute, Nodes (1, 4, 5) that are adjacent to 3 will burn completely.

After two minutes, the only remaining Node 2 will be burnt and there will be no nodes remaining in the binary tree. 

So, the whole tree will burn in 2 minutes.
Problem approach

I first thought of DFS, and BFS approaches but then tried using heap but couldn't solve since the approach was wrong.

Try solving now

2. Distance between nodes of a binary tree

Moderate
25m average time
60% success
0/80
Asked in companies
OracleAmazonGoogle

Given a binary tree and the value of two nodes, find the distance between the given two nodes of the Binary Tree.

Distance between two nodes is defined as the minimum number of edges in the path from one node to another.

Problem approach

Since I messed up in the first question and already wasted a lot of time. I couldn't come u with any 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

Which operator is used for exponentiation in Python?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by Amazon
1389 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Amazon
571 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
576 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
1302 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
13095 views
1 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
7620 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Google
5451 views
1 comments
0 upvotes