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

SDE - 1

Amazon
upvote
share-icon
4 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 2 months
Topics: Dynamic Programming, Breath first search, Depth first search, sorting algorithms, Trees(Binary tree and others)
Tip
Tip

Tip 1 : practice coding 
Tip 2 : practice explaining your code 
Tip 3 : there's no issue with language, you can choose any coding language of yor choice

Application process
Where: Campus
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1 : Have some projects in your resume that could be impressive
Tip 2 : an internship experience in the resume could be a plus

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date18 Nov 2021
Coding problem1

20 Objective Questions: Aptitude and basic C objective problems.
2 Subjective Questions: both coding

1. All Root to Leaf Paths In Binary Tree.

Moderate
25m average time
70% success
0/80
Asked in companies
AmazonInfo Edge India (Naukri.com)Mathworks

You are given an arbitrary binary tree consisting of 'N' nodes numbered from 1 to 'N'. Your task is to print all the root to leaf paths of the binary tree.

A leaf of a binary tree is the node which does not have a left child and a right child.


For Example :
Given a binary tree :

alt txt

All the root to leaf paths are :
1 2 4
1 2 5 
1 3

Note :

1. Two nodes may have the same value associated with it.
2. The root node will be fixed and will be provided in the function.
3. Note that the nodes in a path will appear in a fixed order. For example, 1 2 3 is not the same as 2 1 3.
4. Each path should be returned as a string consisting of nodes in order and separated by a space.
5. The path length may be as small as ‘1’.
Problem approach

The idea is to use DFS Traversal to travel from the root to the leaf of the binary tree and calculate the sum of each root to leaf path. Follow the steps below to solve the problem:

1. Start from the root node of the Binary tree with the initial path sum of 0.
2. Add the value of the current node to the path sum.
3. Travel to the left and right child of the current node with the present value of the path sum.
4. Repeat Step 2 and 3 for all the subsequent nodes of the binary tree.
5. On reaching the leaf node, add the path sum to the vector of pathSum.
6. Print all the elements of the vector pathSum as the output.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date14 Dec 2021
Coding problem2

The interviewer started with a quick introduction and then moved straight to codeing questions, theme was not just to solve the question but to also discuss it with the interviewer, it was a very frank discussion , interviewer was also guiding me at some points. He asked me to solve two coding questions and it took about an hr.

1. Longest Valid Parentheses

Moderate
10m average time
90% success
0/80
Asked in companies
IntuitCIS - Cyber InfrastructureUber

You are given a string ‘S’ containing only the characters ‘)’ and ‘(‘. You need to find the length of the longest valid i.e. well-formed parentheses substring.

For example:
Let the given string be “(()())((”.

Here the valid parentheses substrings are: “()”, “()” and “(()())”. Out of these the longest valid string is “(()())” which has a length 6.
Problem approach

store indexes of previous starting brackets in a stack. The first element of the stack is a special element that provides index before the beginning of valid substring (base for next valid string).

Try solving now

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

Run a for loop for counter i, i.e. current height from 1 to h (height of the tree).
Use DFS to traverse the tree and maintain height for the current node.
If the Node is NULL then return;
If level is 1 print(tree->data);
Else if the level is greater than 1, then
Recursively call to for tree->left, level-1.
Recursively call to for tree->right, level-1.

Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date15 Dec 2021
Coding problem1

This round was similar with the last round , the interviewer started with a quick introduction and then moved straight to codeing questions.

1. Merge k sorted lists

Hard
25m average time
65% success
0/120
Asked in companies
AmazonIntuitPayPal

Given 'k' sorted linked lists, each list is sorted in increasing order. You need to merge all these lists into one single sorted list. You need to return the head of the final linked list.


For example:
Input:
3
3
4 6 8
3
2 5 7 
2
1 9

Output:
1 2 4 5 6 7 8 9 

Explanation:
First list is: 4 -> 6 -> 8 -> NULL
Second list is: 2 -> 5 -> 7 -> NULL
Third list is: 1 -> 9 -> NULL
The final list would be: 1 -> 2 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> NULL
Problem approach

pair up K lists and merge each pair in linear time using O(n) space.
After the first cycle, K/2 lists are left each of size 2*N. After the second cycle, K/4 lists are left each of size 4*N and so on.
Repeat the procedure until we have only one list left.

Try solving now
04
Round
Easy
Video Call
Duration60 minutes
Interview date17 Dec 2021
Coding problem1

This was an HR + technical round, interviewer asked me questions related to my projects, and intersts, discussed about my experiences in my internship, and one codeing question

1. Missing Number

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

You are given an array/list ‘BINARYNUMS’ that consists of ‘N’ distinct strings which represent all integers from 0 to N in binary representation except one integer. This integer between 0 to ‘N’ whose binary representation is not present in list ‘BINARYNUMS’ is called ‘Missing Integer’.

Your task is to find the binary representation of that ‘Missing Integer’. You should return a string that represents this ‘Missing Integer’ in binary without leading zeros.

Note

1. There will be no leading zeros in any string in the list ‘BINARYNUMS’.

Example:

Consider N = 5 and the list ‘binaryNums’=  [“0”, “01”, “010”, “100”, “101”].  This list consists of the binary representation of numbers [0, 1, 2, 4, 5]. Clearly, the missing number is 3 and its binary representation will be “11”. So you should return string “11”.
Problem approach

Calculate the sum of the first N natural numbers as sumtotal= N*(N+1)/2.
Traverse the array from start to end.
Find the sum of all the array elements.
Print the missing number as SumTotal – sum of array

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