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: 3 Months
Topics: Data structuresAlgorithmsoopsdbmsoperating system
Tip
Tip

Tip 1 : Prepare General dsa questions
Tip 2 : Revise dsa regularly
Tip 3 : Study core cse subject

Application process
Where: Email Approach
Eligibility: 2021 passout
Resume Tip
Resume tip

Tip 1 : Mention recent job experience
Tip 2 : Mention good projects

Interview rounds

01
Round
Medium
Online Coding Test
Duration60 Minutes
Interview date28 Mar 2022
Coding problem2

Browser proctored. Only 2 coding questions were there. Timing was 60 minutes. Questions were of medium level

1. Reduce Array

Moderate
25m average time
65% success
0/80
Asked in companies
IntuitAmazon

Ninja was solving questions on the array where he came across a question in which Ninja has an array ‘ARR’ of ‘N’ integers in which he has to perform the following operations to get the result.

1- In one successful operation, Ninja can remove two positive integers, ‘A’ and ‘B’, and insert their sum, i.e., ‘A’ + ‘B’ into the position of either ‘A’ or ‘B’.

2- To insert sum in the position of element ‘A’, the condition 2 * ’A’ >= ‘B’ should be satisfied. Similarly, to insert the sum in the position of element ‘B’, the condition 2 * ‘B’ >= A should be satisfied.

3- We will insert the sum at one position, and the value at the other position should be changed to -1.

4- The resultant array should contain only 1 positive element.

Your task is to find the count of distinct combinations possible for the array.

Note:
A combination is different if they lead to a different position of the element that remains positive at the end of all successful operations for that combination.
For example:
Let ‘ARR’ be: {2, 1}
Combination 1: 
Pick 2 and 1 and insert their sum at the position of 2: [3, -1]

Combination 2:
Pick 2 and 1 and insert their sum at the position of 1: [-1, 3]

So total combinations are 2.
Problem approach

1- I used 1 simple loop and no extra space.
2- In each step keep reducing number of elements by adding adjacent numbers
3 - return the number after last iteration

Try solving now

2. Minimum Parentheses

Easy
10m average time
90% success
0/40
Asked in companies
Info Edge India (Naukri.com)MicrosoftAmazon

Given a string "pattern", which contains only two types of characters ‘(’, ‘)’.

Your task is to find the minimum number of parentheses either ‘(’, ‘)’ we must add the parentheses in string ‘pattern’ and the resulted string is valid.

Condition for valid string-

Every opening parenthesis ‘(’ must have a correct closing parenthesis ‘)’.

Example - ‘(()(()))’, ‘()()()’, ‘((()))’ are valid string, and ‘(((’, ‘(()’, ‘)(())’ are invalid string.

Note:
1. You are not required to print the output explicitly, it has already been taken care of. Just implement the function and return the minimum number of parentheses required to make a string valid.
Try solving now
02
Round
Easy
Telephonic
Duration60 Minutes
Interview date28 Apr 2022
Coding problem2

It was an online interview on amazon chime platform. 2 coding questions were asked then some amazon leadership principal based questions;

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

1. Use recursion
2. traverse entire tree
3. keep track of maximus sum of subtree visited so far
4. compare the maximum sum and update the ans variable

Try solving now

2. Middle Of Linked List

Easy
20m average time
80% success
0/40
Asked in companies
SamsungGoldman SachsOracle

Given a singly linked list of 'N' nodes. The objective is to determine the middle node of a singly linked list. However, if the list has an even number of nodes, we return the second middle node.

Note:
1. If the list is empty, the function immediately returns None because there is no middle node to find.
2. If the list has only one node, then the only node in the list is trivially the middle node, and the function returns that node.
Problem approach

Tip 1 : Use two pointer approach
Tip 2 : Update slow pointer by one step and fast pointer by two step
Tip 3 : when loop break slow pointer gives you middle point

Try solving now
03
Round
Easy
Telephonic
Duration60 Minutes
Interview date28 Jun 2022
Coding problem2

It was another online coding interview and then followed by some behavioural questions.

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

1. use binary search
2. find the point from which array is rotated by using modified binary search
3. then find element using normal binary search either on low-rotated-point or rotated-point - high range

Try solving now

2. Detect Cycle in a Directed Graph

Moderate
25m average time
65% success
0/80
Asked in companies
AmazonAmerican ExpressOYO

Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least one cycle, else return false.

Problem approach

1. use either bfs or dfs
2. I traversed graph using dfs
3. when I reached a node which was already visited then returned true
3. return false if there is no cycle

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