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

SDE - 1

Amazon
upvote
share-icon
4 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Journey
I started coding 2 years back when I was in 2nd year. I got to know that to get an internship we have to do some coding-type stuff. I started with basic coding and started with hackerank and gradually increases the difficulty of the problem. After that, I moved to leetcode and firstly I solved problems on the basis of tags, first easy then medium then hard. Do all the standard problems of each topic.
Application story
Amazon came to our college to hire final-year students for the SDE-1 role. First round was online assessment and then amazon principle round. Then 3 round of interview were taken.
Why selected/rejected for the role?
I was able to answer all the questions, but in one question, I could not give a proper explanation and optimized approach. Maybe that was the reason the rest of my interviews went well. But the interview process was very random.
Preparation
Duration: 6 months
Topics: DSA , Oops , Amazon principles(very important) ,DP , Array
Tip
Tip

Tip 1 : Have at least one project in resume
Tip 2 : resume should be one page only strictly
Tip 3 : Put some achievements like you got a good rank in a coding contest to help you stand out.

Application process
Where: Campus
Eligibility: 6.5
Resume Tip
Resume tip

Tip 1:Make your resume 1 page
Tip 2:Mention at least one project in your resume.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 mins
Interview date26 Aug 2022
Coding problem2

It was at 10 am sharp in the morning. There were two parts to the online assessment round. The first part is the coding round(two questions were asked). And 2nd part is the work simulation round.

1. Equilibrium Index

Easy
0/40
Asked in companies
Chegg Inc.Goldman SachsCoinbase

You are given an array Arr consisting of N integers. You need to find the equilibrium index of the array.

An index is considered as an equilibrium index if the sum of elements of the array to the left of that index is equal to the sum of elements to the right of it.

Note:

1. The array follows 0-based indexing, so you need to return the 0-based index of the element.
2. Note that the element at the equilibrium index won’t be considered for either left sum or right sum.
3. If there are multiple indices which satisfy the given condition, then return the left-most index i.e if there are indices i,j,k…. which are equilibrium indices, return the minimum among them
4. If no such index is present in the array, return -1.
Problem approach

The idea is to get the total sum of the array first. Then Iterate through the array and keep updating the left sum, which is initialized as zero. In the loop, we can get the correct sum by subtracting the elements individually.

Try solving now

2. Subarray With Given Sum

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

Given an array ARR of N integers and an integer S. The task is to find whether there exists a subarray(positive length) of the given array such that the sum of elements of the subarray equals to S or not. If any subarray is found, return the start and end index (0 based index) of the subarray. Otherwise, consider both the START and END indexes as -1.

Note:

If two or more such subarrays exist, return any subarray.

For Example: If the given array is [1,2,3,4] and the value of S is equal to 7. Then there are two possible subarrays having sums equal to S are [1,2,3] and [3,4].

Problem approach

An efficient solution is while traversing the array, storing sum so far in currsum. Also, maintain the count of different values of currsum in a map. If the value of currsum is equal to the desired sum at any instance increment count of subarrays by one. 

The value of currsum exceeds the desired sum by currsum – sum. If this value is removed from currsum then the desired sum can be obtained. From the map, find the number of subarrays previously found having sum equal to currsum-sum. Excluding all those subarrays from the current subarray, gives new subarrays having the desired sum. 

So increase count by the number of such subarrays. Note that when currsum is equal to the desired sum then also check the number of subarrays previously having a sum equal to 0. Excluding those subarrays from the current subarray gives new subarrays having the desired sum. Increase the count by the number of subarrays having sum 0 in that case.

Try solving now
02
Round
Easy
Video Call
Duration65 mins
Interview date30 Aug 2022
Coding problem2

It was in the morning time at 9 am.
The interviewer was an SDE-2; he introduced himself and asked the same of me.
Then asked me about my internship and then directly jumped to coding questions.

1. Level Order Traversal

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

You have been given a Binary Tree of integers. You are supposed to return the level order traversal of the given tree.

For example:
For the given binary tree

Example

The level order traversal will be {1,2,3,4,5,6,7}.
Problem approach

For each node, first, the node is visited and then it’s child nodes are put in a FIFO queue. Then again the first node is popped out and then it’s child nodes are put in a FIFO queue and repeat until queue becomes empty.

Try solving now

2. Remove Consecutive Duplicates

Easy
0/40
Asked in companies
OlaWalmartSamsung

You are given a string ‘str’ of size ‘N’. Your task is to remove consecutive duplicates from this string recursively.

For example:

If the input string is ‘str’ = ”aazbbby”, then your output will be “azby”.
Note that we are just removing adjacent duplicates.
Problem approach

Basic Approach is to create a Stack that store the
Character and its continuous repetition number This is
done using pair Further we check at each
iteration, whether the character matches the top of stack
if it does then check for number of repetitions
else add to top of stack with count 1

Try solving now
03
Round
Medium
Video Call
Duration70 mins
Interview date30 Aug 2022
Coding problem2

It was at 12 pm on the same day at Amazon chime platform.
Interviewer seems to be an experienced one.
He introduced himself then asked the same from me.
Started with some amazon principle question.
And then asked 2 coding problems.

1. Situation based Questions

Tell me a time when you have taken responsibility for a project and given good results.
Tell me a time you have worked under pressure and given an exceptional result.

2. Cycle Detection in a Singly Linked List

Moderate
15m average time
80% success
0/80
Asked in companies
Morgan StanleyDunzoOYO

You are given a Singly Linked List of integers. Return true if it has a cycle, else return false.


A cycle occurs when a node's next points back to a previous node in the list.


Example:
In the given linked list, there is a cycle, hence we return true.

Sample Example 1

Problem approach

He was basically asking for this specific algorithm flyod warshell algo
Follow the steps below to solve the problem:
Traverse linked list using two pointers.
Move one pointer(slow_p) by one and another pointer(fast_p) by two.
If these pointers meet at the same node then there is a loop. If pointers do not meet then the linked list doesn’t have a loop.

Try solving now
04
Round
Hard
Video Call
Duration70 mins
Interview date30 Aug 2022
Coding problem2

It was at 4 pm on the same day at Amazon chime platform.
Interviewer introduced himself then asked the same from me.
Started with some amazon principle question.
And then asked 2 coding problems.

1. Minimum Jumps

Moderate
25m average time
75% success
0/80
Asked in companies
DirectiMakeMyTripOYO

Bob lives with his wife in a city named Berland. Bob is a good husband, so he goes out with his wife every Friday to ‘Arcade’ mall.

‘Arcade’ is a very famous mall in Berland. It has a very unique transportation method between shops. Since the shops in the mall are laying in a straight line, you can jump on a very advanced trampoline from the shop i, and land in any shop between (i) to (i + Arr[i]), where Arr[i] is a constant given for each shop.

There are N shops in the mall, numbered from 0 to N-1. Bob's wife starts her shopping journey from shop 0 and ends it in shop N-1. As the mall is very crowded on Fridays, unfortunately, Bob gets lost from his wife. So he wants to know, what is the minimum number of trampoline jumps from shop 0 he has to make in order to reach shop N-1 and see his wife again. If it is impossible to reach the last shop, return -1.

Problem approach

Follow the below steps to implement the idea:

Create jumps[] array from left to right such that jumps[i] indicate the minimum number of jumps needed to reach arr[i] from arr[0].
To fill the jumps array run a nested loop inner loop counter is j and the outer loop count is i.
Outer loop from 1 to n-1 and inner loop from 0 to i.
If i is less than j + arr[j] then set jumps[i] to minimum of jumps[i] and jumps[j] + 1. initially set jump[i] to INT MAX
Return jumps[n-1].

Try solving now

2. Connect Nodes at Same Level

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

A binary tree is a tree where each node has at most two children i.e left child and right child.

You are given a binary tree, where the structure of the node is as follow -:

class BinaryTreeNode {
 int data;      // Value of the node.
 BinaryTreeNode *left;  // Pointer to left child node.
 BinaryTreeNode *right; // Pointer to right child node.
 BinaryTreeNode *next;  // Pointer to next right node at same level. 
}

Your task is to connect all the adjacent nodes at the same level in the given binary tree. You can do this by populating each 'next' pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all the next pointers are set to NULL.

For Example:

Consider the figure shown below. The left part represents the initial binary tree and right part represents the binary tree after connecting adjacent nodes at the same level.

alt text

In the tree shown in the picture above -:
The ‘next’ pointer of the node having value 2 is connected to the node having value 3.
The ‘next’ pointer of the node having value 4 is connected to the node having value 5.
The ‘next’ pointer of the node having value 5 is connected to the node having value 6.
The ‘next’ pointer of nodes having value 1, 3, 6 will have a value NULL as there are no next right nodes in their cases.

Note:

1. The structure of the ‘Node’ of a binary tree is already defined. You should not change it.   
2. The root of the binary tree is known to you.  
3. There is at least one node in the given binary tree.
4. You may only use constant extra space.
Problem approach

Not able to optimize the approach.
we traversed the nodes in pre-order fashion. Instead of traversing in Pre Order fashion (root, left, right), if we traverse the nextRight node before the left and right children (root, nextRight, left), then we can make sure that all nodes at level i have the nextRight set, before the level i+1 nodes. Let us consider the following example (same example as previous post). Method 2 fails for right child of node 4. In this method, we make sure that all nodes at the 4’s level (level 2) have nextRight set, before we try to set the nextRight of 9. So when we set the nextRight of 9, we search for a nonleaf node on right side of node 4 (getNextRight() does this for us).

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