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

SDE - 1

Amazon
upvote
share-icon
5 rounds | 10 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 Months
Topics: Data structures, algorithms, oops, graphs, os, cn, dbms
Tip
Tip

Tip 1 : before interview, practice questions with company tag on websites like leetcode and see previous experiences
Tip 2 : even if you're able to solve the question, see approaches used by other people and try to solve the question in multiple ways
Tip 3 : prepare questions on leadership principles

Application process
Where: Other
Eligibility: Only female candidates allowed
Resume Tip
Resume tip

Tip 1 : put links of your work like competitive coding profiles, hosted projects, github, etc 
Tip 2 : revise everything on your resume before interview

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 Minutes
Interview date16 Aug 2021
Coding problem1

1. Longest Palindromic Substring

Moderate
20m average time
80% success
0/80
Asked in companies
MathworksLivekeeping (An IndiaMART Company)Goldman Sachs

You are given a string 'str' of length 'N'.


Your task is to return the longest palindromic substring. If there are multiple strings, return any.


A substring is a contiguous segment of a string.


For example :
str = "ababc"

The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome. 

There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
Problem approach

1. Calculated LPS using DP (length1) 
2. Length of shortest palindromic substring = 1 (length2) 
3. Returned length1 - length2

Try solving now
02
Round
Medium
Online Coding Interview
Duration145 Minutes
Interview date24 Aug 2021
Coding problem2

1. Two Sum

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

You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.

Note:

We cannot use the element at a given index twice.

Follow Up:

Try to do this problem in O(N) time complexity. 
Try solving now

2. Minimum Cost to Connect All Points

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

You are given an array, ‘COORDINATES’ that represents the integer coordinates of some points on a 2D plane. Your task is to find the minimum cost to make all the points connected where the cost of connecting two points: (x1, y1) and (x2, y2) is equal to the manhattan distance between them, i.e., |x1 - x2| + |y1 - y2|.

Note:

1) An element of the ‘COORDINATES’ array is a pair of ‘X' and ‘Y’ coordinates of a point, i.e., COORDINATES[i] =  (Xi, Yi).

2) |DISTANCE| represents the absolute value of distance.

3) All points are considered to be connected if there is exactly one simple path between two points.

4) According to Wikipedia, a simple path is a path in a plane that does not have repeating points.
Try solving now
03
Round
Medium
Video Call
Duration60 Minutes
Interview date11 Nov 2021
Coding problem2

1. First Missing Positive

Moderate
18m average time
84% success
0/80
Asked in companies
DunzoHikeSamsung

You are given an array 'ARR' of integers of length N. Your task is to find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can have negative numbers as well.

For example, the input [3, 4, -1, 1] should give output 2 because it is the smallest positive number that is missing in the input array.

Problem approach

-The largest possible answer is N+1 (if all elements from 1-N are present), so make an array called pos, of size n+1 where n is the size of given array. Initialize it with all values = - 1
-Traverse the input array and every time you encounter a number in the range 1-n update its location in the pos array.
- now traverse the pos array and find the first position with -1 as its value. The index of that position is the first missing positive number.

Try solving now

2. Right View

Moderate
35m average time
65% success
0/80
Asked in companies
AmazonAdobeUber

You have been given a Binary Tree of integers.

Your task is to print the Right view of it.

The right view of a Binary Tree is a set of nodes visible when the tree is viewed from the Right side and the nodes are printed from top to bottom order.

Try solving now
04
Round
Hard
Video Call
Duration70 Minutes
Interview date11 Nov 2021
Coding problem3

1. Min Stack

Easy
0/40
Asked in companies
Morgan StanleyPostmanDelhivery

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

1. Push(num): Push the given number in the stack.
2. Pop: Remove and return the top element from the stack if present, else return -1.
3. Top: return the top element of the stack if present, else return -1.
4. getMin: Returns minimum element of the stack if present, else return -1.

For Example:

For the following input: 
1
5
1 1
1 2
4
2
3

For the first two operations, we will just insert 1 and then 2 into the stack which was empty earlier. So now the stack is => [2,1]
In the third operation, we need to return the minimum element of the stack, i.e., 1. So now the stack is => [2,1]
For the fourth operation, we need to pop the topmost element of the stack, i.e., 2. Now the stack is => [1]
In the fifth operation, we return the top element of the stack, i.e. 1 as it has one element. Now the stack is => [1]

So, the final output will be: 
1 2 1
Try solving now

2. Search in a 2D matrix-II

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

You are given a 2-D matrix of dimensions 'N' x 'M', each row of the matrix is sorted in non-decreasing order, and each column is sorted in non-decreasing order.


You are also given an integer ‘X’. You are supposed to find whether 'X' is present in the given matrix.

Try solving now

3. Minimum Direction Changes

Hard
50m average time
50% success
0/120
Asked in companies
AdobeAmazonOptum

Given a 2D grid having N Rows and M Columns. Each cell of the grid has a character among [ 'U', 'L', 'D', 'R' ] written on it, denoting Up, Left, Down, and Right respectively and indicating the direction in which it is permitted to move from that cell to its neighbor. Your task is to find the minimum number of cells whose direction value is required to be changed so that there exists a path from Top-Left to the Bottom-Right cell by following the directions written on the cells.

For example,
Consider the 2 * 2 grid

sample inp

Let's call the four cells in the grid as A,B,C,D. In this grid, it is allowed to move from Cell A to Cell B, Cell B to Cell D, Cell C to Cell D and Cell D to Cell C. There are two paths that start from A and ends at D:

1) A->C->D
To follow this path we need to change the value of cell A to “D” and do not need to change the value of cell C. Therefore, the total change for this path is 1.

2) A->B->D
To follow this path we need not to change any of the cell values. Therefore the total changes for this path is 0.

As we can see the minimum changes required to reach the bottom-right cell is Zero therefore the answer is 0 in this case.
Try solving now
05
Round
Medium
Video Call
Duration40 Minutes
Interview date20 Dec 2021
Coding problem2

Bar raiser

1. Next Greater Element

Easy
10m average time
90% success
0/40
Asked in companies
MicrosoftAmazonDisney + Hotstar

You have been given an array/list ‘ARR’ consisting of ‘N’ positive integers. Your task is to return the Next Greater Element(NGE) for every element.

The Next Greater Element for an element ‘X’ is the first element on the right side of ‘X’ in the array 'ARR', which is greater than ‘X’. If no such element exists to the right of ‘X’, then return -1.

For example:
For the given array 'ARR' = [7, 12, 1, 20]

The next greater element for 7 is 12.
The next greater element for 12 is 20. 
The next greater element for 1 is 20. 
There is no greater element for 20 on the right side.

So, the output is [12, 20, 20, -1].
Try solving now

2. Smallest Window

Moderate
10m average time
90% success
0/80
Asked in companies
HSBCSAP LabsExpedia Group

You are given two strings S and X containing random characters. Your task is to find the smallest substring in S which contains all the characters present in X.

Example:

Let S = “abdd” and X = “bd”.

The windows in S which contain all the characters in X are: 'abdd', 'abd', 'bdd', 'bd'. 
Out of these, the smallest substring in S which contains all the characters present in X is 'bd'. 
All the other substring have a length larger than 'bd'.
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
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