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

SDE - 1

Amazon
upvote
share-icon
4 rounds | 10 Coding problems

Interview preparation journey

expand-icon
Journey
After beginning my career as a QA professional, I realized my desire to transition into a development role. I switched to a different company to pursue this goal, but I found the work to be unsatisfying. This prompted me to start preparing for a career in development. As part of my daily routine, I made it a priority to solve 5-6 coding problems every day.
Application story
The recruiter initially contacted me through LinkedIn, and the entire interview process took approximately two weeks to complete. After the interviews were finished, I waited an additional week before receiving the results.
Why selected/rejected for the role?
My strong skills in data structures and algorithms (DSA) enabled me to excel during the bar raiser round of the interview process. Drawing from my prior experience, I was able to stand out and make a favorable impression.
Preparation
Duration: 6 months
Topics: Data Structure and Algorithms, Trees, Graphs, Dynamic Programming, Hashmap
Tip
Tip

Tip 1 : Prioritise to solve 4-6 problems daily 
Tip 2 : Clear your basics, you should know to code stack, queue from scratch 
Tip 3 : Give time to solve question by your own before jumping onto the solution

Application process
Where: Linkedin
Eligibility: 12 months of experience
Resume Tip
Resume tip

Tip 1 : Should be precise, don’t include everything, keep something to tell them during interview
Tip 2 : Do not put false things

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date7 Jun 2021
Coding problem3

90 minutes round, 3 DSA problems

1. Trapping Rain Water

Moderate
15m average time
80% success
0/80
Asked in companies
HCL TechnologiesCiti BankAtlassian

You have been given a long type array/list 'arr’ of size 'n’.


It represents an elevation map wherein 'arr[i]’ denotes the elevation of the 'ith' bar.



Note :
The width of each bar is the same and is equal to 1.
Example:
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].

Output: 10

Explanation: Refer to the image for better comprehension:

Alt Text

Note :
You don't need to print anything. It has already been taken care of. Just implement the given function.
Try solving now

2. Sort an array in wave form

Easy
10m average time
90% success
0/40
Asked in companies
OraclePayUAmazon

Your friend Ninja has been learning about binary numbers lately. In order to understand binary numbers with perfection, Ninja asks you to generate a list of binary numbers from 1 to ‘N’, which he can use later for reference.

For every integer Ninja gives, your task is to generate all the binary numbers from 1 to ‘N’.

Example:

Consider N = 5,
All the binary numbers from 1 to 5 are: 1, 10, 11, 100, 101.
Try solving now

3. Generate Binary Numbers

02
Round
Easy
Video Call
Duration60 minutes
Interview date14 Jun 2022
Coding problem3

1. Top View

Moderate
42m average time
61% success
0/80
Asked in companies
SamsungAdobeMakeMyTrip

Given a binary tree. Print the Top View of Binary Tree. Print the nodes from left to right order.

Example:
Input:

Alt text

Output: 2 35 2 10 2
Problem approach

Recursive approch

Try solving now

2. Bottom View of Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
OYOMicrosoftAmazon

You are given a 'Binary Tree'.


Return the bottom view of the binary tree.


Note :
1. A node will be in the bottom-view if it is the bottom-most node at its horizontal distance from the root. 

2. The horizontal distance of the root from itself is 0. The horizontal distance of the right child of the root node is 1 and the horizontal distance of the left child of the root node is -1. 

3. The horizontal distance of node 'n' from root = horizontal distance of its parent from root + 1, if node 'n' is the right child of its parent.

4. The horizontal distance of node 'n' from root = horizontal distance of its parent from the root - 1, if node 'n' is the left child of its parent.

5. If more than one node is at the same horizontal distance and is the bottom-most node for that horizontal distance, including the one which is more towards the right.


Example:
Input: Consider the given Binary Tree:

alt text

Output: 4 2 6 3 7

Explanation:
Below is the bottom view of the binary tree.

alt text

1 is the root node, so its horizontal distance = 0.
Since 2 lies to the left of 0, its horizontal distance = 0-1= -1
3 lies to the right of 0, its horizontal distance = 0+1 = 1
Similarly, horizontal distance of 4 = Horizontal distance of 2 - 1= -1-1=-2
Horizontal distance of 5 = Horizontal distance of 2 + 1=  -1+1 = 0
Horizontal distance of 6 = 1-1 =0
Horizontal distance of 7 = 1+1 = 2

The bottom-most node at a horizontal distance of -2 is 4.
The bottom-most node at a horizontal distance of -1 is 2.
The bottom-most node at a horizontal distance of 0 is 5 and 6. However, 6 is more towards the right, so 6 is included.
The bottom-most node at a horizontal distance of 1 is 3.
The bottom-most node at a horizontal distance of 2 is 7.

Hence, the bottom view would be 4 2 6 3 7


Try solving now

3. Largest subarray with equal number of 0s and 1s

Moderate
10m average time
85% success
0/80
Asked in companies
OraclePhonePeSAP Labs

You are given an array consisting of 0s and 1s. You need to find the length of the largest subarray with an equal number of 0s and 1s.

For example:

If the given array is: [0, 0, 1, 0, 1] The largest subarray would be: [0, 1, 0, 1] (last 4 elements) having length 4.
Problem approach

Graph - DFS Approach

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date21 Jun 2022
Coding problem3

1. Accounts Merge

Hard
15m average time
85% success
0/120
Asked in companies
FacebookPhonePeAmazon

You have been given an array/list 'accounts' where each element, i.e. 'accounts'[i] contains a list of strings.


In 'accounts'[i], the first element is the name of the account holder, and the rest of the strings are emails representing the emails of the account.


Now, you are supposed to merge the accounts. Two accounts definitely belong to the same person if there is some email that is common to both accounts. Note that it may be possible that two accounts belong to the same name, but they may belong to different people, as people could have the same name.


A person could have any number of accounts initially, but all their accounts definitely have the same name.


After merging the accounts, you have to return an array/list of merged accounts where each account, the first element is the person's name, and the rest elements are the email addresses in sorted order (non-decreasing). Accounts themselves can be in any order.


Example:
 Input:  'n' = 4,
 'accounts' = [
    ["Rohan", "rohan123@gmail.com", "1279ro@gmail.com"],
    ["Rohit", "rohit101@yahoo.com", "hitman30487@gmail.com"],
    ["Rohan", "1279ro@gmail.com",  "niemann01@gmail.com"],
    ["Rohan", "kaushik@outlook.com"],
 ]
 Output: [
    ["Rohan", "rohan123@gmail.com", "1279ro@gmail.com", "niemann01@gmail.com"],
    ["Rohit", "rohit101@yahoo.com", "hitman30487@gmail.com"],
    ["Rohan", "kaushik@outlook.com"],
 ]

 Explanation: The first and third "Rohan" are the same person as they have a shared email address, “1279ro@gmail.com”. The rest of the accounts are of different persons, as they don’t share any shared email addresses. So, we merge the first and third accounts.
Try solving now

2. 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.

Try solving now

3. Number of Islands II

Hard
45m average time
55% success
0/120
Asked in companies
MicrosoftAmazonHike

You have a 2D grid of ‘N’ rows and ‘M’ columns which are initially filled with water. You are given ‘Q’ queries each consisting of two integers ‘X’ and ‘Y’ and in each query operation, you have to turn the water at position (‘X’, ‘Y’) into a land. You are supposed to find the number of islands in the grid after each query.

An island is a group of lands surrounded by water horizontally, vertically, or diagonally.

Try solving now
04
Round
Medium
Video Call
Duration60 minutes
Interview date24 Jun 2022
Coding problem1

Managerial Round - interviewer will have 12-15 years of experience

1. Basic HR Questions

Tell me about your project in great detail, including its functionality, UI design, project flow, user impact, and your specific contributions. 

Any potential delays that may have occurred during the project?

Tell me about a time when I had to make an independent decision without consulting my manager.

Problem approach

Tip 1 : Prepare your projects well
Tip 2 : Align your answer with leadership principle 
Tip 3 : Prepare for follow up questions and read about leadership principles

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
8962 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
5983 views
5 comments
0 upvotes