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

SDE - 1

Amazon
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Operating Systems, OOPS, Low-level Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practise Atleast 500 questions
Tip 2 : Do Atleast 3 projects
Tip 3 : Atleast 1 internship experience

Application process
Where: Other
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Add your coding background
Tip 2 : Add at least 3 projects and 1 internship experience

Interview rounds

01
Round
Medium
Video Call
Duration60 minutes
Interview date22 Feb 2022
Coding problem2

Intro and projects discussion: 15 minutes
2 coding questions: 40 minutes
Questions: 5 minutes

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

I first applied recursive approach. It was not good enough
I then applied DP approach and solved it using memoization.

Try solving now

2. Best Time to Buy and Sell Stock

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

maxProfit = 0
if price[i] > price[i – 1]
maxProfit = maxProfit + price[i] – price[i – 1]

Problem approach

maxProfit = 0;
if price[i] > price[i – 1]
maxProfit = maxProfit + price[i] – price[i – 1]

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date22 Feb 2022
Coding problem2

Intro and projects discussion: 15 minutes
2 coding questions: 40 minutes
Questions: 5 minutes

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.
Problem approach

Search from left to right and maintain a max height of left and right separately, which is like a one-side wall of partial container. Fix the higher one and flow water from the lower part. For example, if current height of left is lower, we fill water in the left bin. Until left meets right, we filled the whole container.

Try solving now

2. Pair Sum in BST

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

You are given a Binary Search Tree (BST) and a target value ‘K’. Your task is to return true if there exist two nodes in the given BST such that the sum of their values is equal to the given target ‘K’, else return false.


A binary search tree (BST) is a binary tree data structure which has the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.

• The right subtree of a node contains only nodes with data greater than the node’s data.

• Both the left and right subtrees must also be binary search trees.


Note:
1. All the elements of the Binary Search Tree are unique.

2. You can’t use the same node value/element of BST twice.


For example:
tree: 8 5 10 2 6 -1 -1 -1 -1 -1 7 -1 -1
'K' = 13,

The nodes with values 8 and 5 as shown in the above figure gives sum equal to the given target 13. 

Therefore, the output will be “true” i.e it is possible to find a pair in the given BST having sum equal to ‘K’.
Problem approach

create an auxiliary array and store the Inorder traversal of BST in the array. The array will be sorted as Inorder traversal of BST always produces sorted data. Once we have the Inorder traversal we can get the answer using 2 pointer approach

Try solving now
03
Round
Easy
Video Call
Duration60 minutes
Interview date17 Jun 2022
Coding problem2

Intro and projects discussion: 15 minutes
2 coding questions: 40 minutes
Questions: 5 minutes

1. The Celebrity Problem

Moderate
30m average time
60% success
0/80
Asked in companies
OlaVisaApple

There are ‘N’ people at a party. Each person has been assigned a unique id between 0 to 'N' - 1(both inclusive). A celebrity is a person who is known to everyone but does not know anyone at the party.

Given a helper function ‘knows(A, B)’, It will returns "true" if the person having id ‘A’ know the person having id ‘B’ in the party, "false" otherwise. Your task is to find out the celebrity at the party. Print the id of the celebrity, if there is no celebrity at the party then print -1.

Note:
1. The helper function ‘knows’ is already implemented for you.
2. ‘knows(A, B)’ returns "false", if A doesn't know B.
3. You should not implement helper function ‘knows’, or speculate about its implementation.
4. You should minimize the number of calls to function ‘knows(A, B)’.
5. There are at least 2 people at the party.
6. At most one celebrity will exist.
Problem approach

-Create two indices i and j, where i = 0 and j = n-1
-Run a loop until i is less than j.
-Check if i knows j, then i can’t be a celebrity. so increment i, i.e. i++
-Else j cannot be a celebrity, so decrement j, i.e. j–
-Assign i as the celebrity candidate
-Now at last check that whether the candidate is actually a celebrity by re-running a loop from 0 to n-1 and 
constantly checking that if the candidate knows a person or if there is a candidate who does not know the 
candidate, then we should return -1. else at the end of the loop, we can be sure that the candidate is actually 
a celebrity.

Try solving now

2. System Design Question

Design an Api which implement 3 function:
1: Search in a list(Employees) on the basis of params
2: Add in a list
3: Remove from a list(with Employee ID)

Problem approach

Tip 1 : Have a grip on Low level designs
Tip 2 : Apply the concept of Oops

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
3084 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
2294 views
1 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Amazon
1592 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
58237 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