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

Software Engineer

Amazon
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 12 Months
Topics: Data Structures, Algorithms, Database, System Design, Operating Systems
Tip
Tip

Tip 1 - Practice Data Structure questions as much as you can. Also, be confident during the interview about your solution. For practice, you can prefer Coding Ninjas and Geeks For Geeks.
Tip 2 - Read About amazon leadership principles

Application process
Where: Campus
Eligibility: Btech & Integrated & MTech - CSE/IT/ECE with CGPA of 6.5 & above. No backlogs
Resume Tip
Resume tip

Tip 1 : Keep it short. Mention the academic and professional projects you've done. Add your educational details properly with the percentage or CGPA obtained.
Tip 2 : Only write those things in the resume which you are confident of and keep practicing.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 Minutes
Interview date19 Jan 2022
Coding problem2

There were 2 data structure questions to be done in 70 minutes and 20 minutes for workstyle assessments.

1. Count Distinct Substrings

Moderate
10m average time
90% success
0/80
Asked in companies
AdobeAmazonIntuit

Given a string 'S', you are supposed to return the number of distinct substrings(including empty substring) of the given string. You should implement the program using a trie.

Note :
A string ‘B’ is a substring of a string ‘A’ if ‘B’ that can be obtained by deletion of, several characters(possibly none) from the start of ‘A’ and several characters(possibly none) from the end of ‘A’. 

Two strings ‘X’ and ‘Y’ are considered different if there is at least one index ‘i’  such that the character of ‘X’ at index ‘i’ is different from the character of ‘Y’ at index ‘i’(X[i]!=Y[i]).
Problem approach

The idea is to build a trie for all suffixes of the given string. We will use the fact that every substring of ‘S’ can be represented as a prefix of some suffix string of ‘S’. Hence, if we create a trie of all suffixes of ‘S’ then the number of distinct substrings will be equal to the nodes in the trie. This is because for every substring there will be only one path from the root node of the trie to the last character of the substring, hence no duplicate substrings will be present in the trie.

Try solving now

2. Maximum Subarray Sum

Moderate
35m average time
81% success
0/80
Asked in companies
QualcommUberAmazon

You are given an array 'arr' of length 'n', consisting of integers.


A subarray is a contiguous segment of an array. In other words, a subarray can be formed by removing 0 or more integers from the beginning and 0 or more integers from the end of an array.


Find the sum of the subarray (including empty subarray) having maximum sum among all subarrays.


The sum of an empty subarray is 0.


Example :
Input: 'arr' = [1, 2, 7, -4, 3, 2, -10, 9, 1]

Output: 11

Explanation: The subarray yielding the maximum sum is [1, 2, 7, -4, 3, 2].
Problem approach

We maintain an array curSum[], which keeps track of the maximum sum of the subarray ending at the index we’re at. 

While traversing the array, If the value of curSum[i] becomes negative, we can simply discard this part of the array because it has a negative contribution to the subarray sum. It would be better to just drop that part and have a zero contribution rather than a negative one. Then, we can start anew with the next element. In other words, curSum[i] can be reset to 0.

The maximum value in the curSum array will be our answer.

Try solving now
02
Round
Medium
Face to Face
Duration50 minutes
Interview date26 Jan 2022
Coding problem2

It was a coding Round
The interview started with his introduction and the told me to introduce myself and then told he will be paste a question in the text editor and I have to write a production-level code for the same

1. House Robber

Moderate
26m average time
0/80
Asked in companies
PayPalExpedia GroupGoldman Sachs

A thief wants to loot houses. He knows the amount of money in each house. He cannot loot two consecutive houses. Find the maximum amount of money he can loot.

Problem approach

For every house k, there are two options: either to rob it (include this house: i) or not rob it (exclude this house: e).

Include this house:
i = num[k] + e (money of this house + money robbed excluding the previous house)

Exclude this house:
e = max(i, e) (max of money robbed including the previous house or money robbed excluding the previous house)
(note that i and e of the previous step, that's why we use tmp here to store the previous i when calculating e, to make O(1) space)

Try solving now

2. Detect And Remove Cycle

Easy
10m average time
90% success
0/40
Asked in companies
WalmartOracleGoldman Sachs

You have been given a Singly Linked List of integers, determine if it forms a cycle or not. If there is a cycle, remove the cycle and return the list.

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

Problem approach

we have 2 pointers: slow and fast. Slow pointer takes a single jump and corresponding to every jump slow pointer takes, fast pointer takes 2 jumps. If there exists a cycle, both slow and fast pointers will reach the exact same node. If there is no cycle in the given linked list, then the fast pointer will reach the end of the linked list well before the slow pointer reaches the end or NULL.

Try solving now
03
Round
Medium
Face to Face
Duration60 Minutes
Interview date31 Jan 2022
Coding problem2

It was again DSA round, taken by an SDE- 2 at amazon In which they asked me 2 DSA problems.

1. Valid Sudoku

Moderate
40m average time
60% success
0/80
Asked in companies
QualcommUberDirecti

You have been given a 9 X 9 2D matrix 'MATRIX' with some cells filled with digits(1 - 9), and some empty cells (denoted by 0).

You need to find whether there exists a way to fill all the empty cells with some digit(1 - 9) such that the final matrix is a valid Sudoku solution.

A Sudoku solution must satisfy all the following conditions-

1. Each of the digits 1 - 9 must occur exactly once in each row.
2. Each of the digits 1 - 9 must occur exactly once in each column.
3. Each of the digits 1 - 9 must occur exactly once in each of the 9, 3 x 3 sub-matrices of the matrix.
Note
1. There will always be a cell in the matrix which is empty.
2. The given initial matrix will always be consistent according to the rules mentioned in the problem statement.
Problem approach

Used Backttracking to Solve the problem

Try solving now

2. LCA of three Nodes

Easy
20m average time
60% success
0/40
Asked in companies
MicrosoftAmerican ExpressGrofers

You have been given a Binary Tree of 'N' nodes where the nodes have integer values and three integers 'N1', 'N2', and 'N3'. Find the LCA(Lowest Common Ancestor) of the three nodes represented by the given three('N1', 'N2', 'N3') integer values in the Binary Tree.

For example:

For the given binary tree: the LCA of (7,8,10) is 1
Note:
All of the node values of the binary tree will be unique.

N1, N2, and N3  will always exist in the binary tree.
Problem approach

Used Preorder Traversal to solve the problem

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
Software Engineer
3 rounds | 5 problems
Interviewed by Amazon
3674 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
0 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
2806 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 15 problems
Interviewed by Amazon
1714 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7977 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
10148 views
1 comments
0 upvotes
company logo
Software Engineer
3 rounds | 4 problems
Interviewed by Samsung
2937 views
0 comments
0 upvotes