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

SDE - 1

Amazon
upvote
share-icon
5 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 1 year
Topics: Linkedlist, Trees, Arrays, Stack, Dynamic programming
Tip
Tip

Tip 1 : Read interview experiences
Tip 2 : Solve 2-5 problems everyday
Tip 3 : Have faith

Application process
Where: Company Website
Eligibility: No
Resume Tip
Resume tip

Tip 1 : Have at least 1-2 good projects, internships. 
Tip 2 : Prepare a storyline based on your internship/job experience

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 Minutes
Interview date25 May 2021
Coding problem1

1. Find Number Of Islands

Moderate
34m average time
60% success
0/80
Asked in companies
WalmartShareChatAmazon

You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.

A cell is said to be connected to another cell, if one cell lies immediately next to the other cell, in any of the eight directions (two vertical, two horizontal, and four diagonals).

A group of connected cells having value 1 is called an island. Your task is to find the number of such islands present in the matrix.

Problem approach

I applied simple dfs on matrix.

Try solving now
02
Round
Medium
Online Coding Interview
Duration60 Minutes
Interview date13 Oct 2021
Coding problem2

1. Search In Rotated Sorted Array

Moderate
30m average time
65% success
0/80
Asked in companies
InformaticaDelhiveryGoldman Sachs

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4, 5] and if he rotates it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, Aahad needs to answer Q queries asked by Harshit, each of them is described by one integer Q[i]. which Harshit wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where 'key' denotes Q[i]. If the key exists in the array, return the index of the 'key', otherwise, return -1.

Note:

Can you solve each query in O(logN) ?
Problem approach

I applied Modified binary search.

Try solving now

2. Binary Tree Maximum Path Sum

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

You are given a binary tree with ‘N’ nodes.

Your task is to find the “Maximum Path Sum” for any path.

Note :

1. A ‘path’ is a sequence of adjacent pair nodes with an edge between them in the binary tree.
2. The ‘path’ doesn’t need to pass through the root.
3. The ‘path sum’ is the sum of the node’s data in that path. 
Problem approach

Traverse tree and track max of right and left path sum from current node, and overall answer under current subtree.

Try solving now
03
Round
Medium
Online Coding Interview
Duration60 Minutes
Interview date13 Oct 2021
Coding problem2

1. Stock Span

Moderate
20m average time
65% success
0/80
Asked in companies
AmazonDunzoAmazon

Afzal has been working with an organization called 'Money Traders for the past few years. The organization is in the money trading business. His manager assigned him a task.


Given an array ’prices’ which denotes stock prices for ’n’ days, e.g., 'prices[ i ]' = price of the stock at ‘ith’ day, Find the stock's span for each day.


The span of the stock's price today is defined as the maximum number of consecutive days(starting from today and going backward) for which the price of the stock was less than today's price.


Example:
Input: ‘n’ = 7,  ‘prices’ = [100, 80, 60, 70, 60, 75, 85]

Output: [1, 1, 1, 2, 1, 4, 6]

Explanation: 
On the sixth day, when the stock price was 75, 

The span came out to be 4 because the last three prices(plus today) were less than the current or the sixth day's price.

Similarly, we can deduce the remaining results.
Note:
You don’t need to print anything. Just implement the given function
Try solving now

2. Coin Change(Finite Supply)

Hard
0/120
Asked in companies
IBMAdobeAmazon

You are given an array of integers ‘coins’ denoting the denomination of coins and another array of integers ‘freq’ denoting the number of coins of each denomination.

You have to find the number of ways to make the sum ‘V’ by selecting some(or all) coins from the array.

The answer can be very large. So, return the answer modulo 1000000007.

For Example :
‘N’ = 3, ‘coins’ = {1, 2, 3}, ‘freq’ = {1, 1, 3}, ‘V’ = 6

For the given example, we can make six by using the following coins:
{1, 2, 3}
{3. 3}
Hence, the answer is 2.
Problem approach

Applied dp

Try solving now
04
Round
Medium
Online Coding Interview
Duration60 Minutes
Interview date26 Oct 2021
Coding problem2

1. Largest sub-tree sum

Easy
15m average time
85% success
0/40
Asked in companies
OlaAmazonGoogle inc

You have been given a Binary Tree of integers. You are supposed to return the largest subtree sum in the given Binary Tree.

The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself).

Example :
For the given binary tree:

Example

Subtree with the largest sum is highlighted in the above image. The sum is (-2 + 4 + 7) = 9
Try solving now

2. Reverse Linked List

Moderate
15m average time
85% success
0/80
Asked in companies
WalmartHCL TechnologiesInfo Edge India (Naukri.com)

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked list is 4 -> 3 -> 2 -> 1 -> NULL and the head of the reversed linked list will be 4.
Follow Up :
Can you solve this problem in O(N) time and O(1) space complexity?
Problem approach

3 pointers technique.

Try solving now
05
Round
Hard
Online Coding Interview
Duration60 Minutes
Interview date26 Oct 2021
Coding problem2

1. Median in a stream

Hard
50m average time
50% success
0/120
Asked in companies
OlaInfo Edge India (Naukri.com)Samsung

Given that integers are read from a data stream. Your task is to find the median of the elements read so far.

Median is the middle value in an ordered integer list. If the size of the list is even there is no middle value. So the median is the floor of the average of the two middle values.

For example :
[2,3,4] - median is 3.
[2,3] - median is floor((2+3)/2) = 2.


Problem approach

Used one min heap and one max heap.

Try solving now

2. Merge k sorted lists

Hard
25m average time
65% success
0/120
Asked in companies
AmazonIntuitPayPal

Given 'k' sorted linked lists, each list is sorted in increasing order. You need to merge all these lists into one single sorted list. You need to return the head of the final linked list.


For example:
Input:
3
3
4 6 8
3
2 5 7 
2
1 9

Output:
1 2 4 5 6 7 8 9 

Explanation:
First list is: 4 -> 6 -> 8 -> NULL
Second list is: 2 -> 5 -> 7 -> NULL
Third list is: 1 -> 9 -> NULL
The final list would be: 1 -> 2 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> NULL
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 - 1
3 rounds | 5 problems
Interviewed by Amazon
3085 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
2295 views
1 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Amazon
1593 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
8963 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58238 views
5 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Samsung
12649 views
2 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Microsoft
5984 views
5 comments
0 upvotes