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

SDE - 1

Amazon
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 Months
Topics: Data Structures and Algorithms, OS, DBMS, OOPS, DP
Tip
Tip

Tip 1 : prepare company specific problems from internet
Tip 2 : Practice more and more
Tip 3 : Clear your basics properly

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

Tip 1 : Have some good skills
Tip 2 : Have some projects on resume.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration170 minutes
Interview date16 Apr 2022
Coding problem2

Two coding questions will be there one easy for me and another one medium

1. NINJAS TRUCK

Easy
15m average time
85% success
0/40
Asked in companies
WalmartAmazonLivekeeping (An IndiaMART Company)

Ninja is assigned a task to deliver some boxes which contain different units having different weights. With the help of his truck, he will earn money on the basis of the number of units of boxes he will deliver by his truck. Ninja truck has some capacity on the number of boxes he can put on his truck.

So your task is to find a way so that ninja will choose boxes in a way that units will be maximum and he would be able to get more money you will be provided with an array of ‘BOX’, where BOX[i] = [countofBoxes, unitsperBox].

CountofBoxes represents the number of boxes of the same type i.e containing the units of the same value.

UnitsperBox represents the number of units in the box or we simply say that unit value.

And an integer ‘K’ denoting the limit of boxes on the truck.

Problem approach

Using some DSA algorithms

Try solving now

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

The idea is to traverse every array element and find the highest bars on the left and right sides. Take the smaller of two heights. The difference between the smaller height and the height of the current element is the amount of water that can be stored in this array element.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date1 Jun 2022
Coding problem2

Its technical round where they have given two problems

1. First K Maximum Elements

Easy
10m average time
90% success
0/40
Asked in companies
AmazonProdapt SolutionsD.E.Shaw

You have been given an array of ‘N’ integers and an integer 'K'. You have to find the indexes of the first 'K' maximum elements in the array.

Note :

'K' must be less than or equal to the number of distinct elements in the given array.

Consider '0’ based indexing of the elements in the given array.

Print all indexes in increasing order.

For Example :

If, 'ARR' = [4, 2, 4, 2, 1], and K = 2. Then output will be 0, 1, 2, 3.
Problem approach

I have solved first with time complexity o(n) then interviewer told me that solve it in less time then I have solved using method in which we are finding first mid then applying some cases

Try solving now

2. Top View Of Binary Tree

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

You are given a Binary Tree of 'n' nodes.


The Top view of the binary tree is the set of nodes visible when we see the tree from the top.


Find the top view of the given binary tree, from left to right.


Example :
Input: Let the binary tree be:

Example

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

Explanation: Consider the vertical lines in the figure. The top view contains the topmost node from each vertical line.
Problem approach

Logic I applied : First, I find the horizontal distance of all nodes then some little bit logic like the node with that horizontal distance present in hashmap then don't append

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date1 Jun 2022
Coding problem1

Its technical and behavioural round

1. LCA Of Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
GrabDisney + HotstarShareChat

You have been given a Binary Tree of distinct integers and two nodes ‘X’ and ‘Y’. You are supposed to return the LCA (Lowest Common Ancestor) of ‘X’ and ‘Y’.


The LCA of ‘X’ and ‘Y’ in the binary tree is the shared ancestor of ‘X’ and ‘Y’ that is located farthest from the root.


Note :
You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For example :
For the given binary tree

Example

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
Problem approach

I did this using recursion

Try solving now
04
Round
Easy
Face to Face
Duration60 minutes
Interview date5 Jun 2022
Coding problem2

Its bar raiser round

1. Find Peak Element

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

You are given an array 'arr' of length 'n'. Find the index(0-based) of a peak element in the array. If there are multiple peak numbers, return the index of any peak number.


Peak element is defined as that element that is greater than both of its neighbors. If 'arr[i]' is the peak element, 'arr[i - 1]' < 'arr[i]' and 'arr[i + 1]' < 'arr[i]'.


Assume 'arr[-1]' and 'arr[n]' as negative infinity.


Note:
1.  There are no 2 adjacent elements having same value (as mentioned in the constraints).
2.  Do not print anything, just return the index of the peak element (0 - indexed).
3. 'True'/'False' will be printed depending on whether your answer is correct or not.


Example:

Input: 'arr' = [1, 8, 1, 5, 3]

Output: 3

Explanation: There are two possible answers. Both 8 and 5 are peak elements, so the correct answers are their positions, 1 and 3.


Problem approach

I first applied brute force method. It was not good enough.
Interviewer asked me to optimise the solution.
Then I gave solution with binary search and interviewer was happy.

Try solving now

2. Project Related Questions

  • Explain your project?
  • What are the tech skills that you used in this project?
  • What difficulties you faced during the making of this project?
Problem approach

Its related to project experience like what difficulty you faced in these projects that you have mentioned in your resume

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