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

SDE - 1

Amazon
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures, Algorithms, OOPS, Low Level Design, Database Management System
Tip
Tip

Tip 1 : Practise new questions
Tip 2 : Give mock interviews
Tip 3 : Give time based contests

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

Tip 1 : Have some projects on resume
Tip 2 : Keep it concise and accurate

Interview rounds

01
Round
Medium
Online Coding Interview
Duration105 minutes
Interview date27 Feb 2022
Coding problem2

There were 2 Coding questions and 2 questions for describing the solution apprach for the coding questions. Bothe were of Medium level.

1. Occurrence Of Each Word

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

You are given a string S of words. Your task is to count the occurrence of each word present in the string S. A word is a sequence of one or more non-space characters, and there can be multiple spaces between two words, and also there can be leading or trailing spaces in a string S.

For Example:
For the given string  “what we think we become”

“what”,” think”, and “become” occurs 1 time, and “we” occurs 2 times in the given string.
Problem approach

I used stacks to provide efficient solution and was able to pass all test cases.

Try solving now

2. Ways To Make Coin Change

Moderate
20m average time
80% success
0/80
Asked in companies
MicrosoftHSBCOracle

You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change for value V using coins of denominations from D. Print 0, if a change isn't possible.

Problem approach

I used bottom up apprach to solve the problem with the given constraints and was able to pass all the test cases.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date9 Apr 2022
Coding problem2

It was a video interview in the afternoon with an SDE. The interview started with an introduction of both of us and then we had some discussions around my Project and Work Experience and then 2 coding questions based on DSA. The interviewer was friendly and we had a good dicussion.

1. Remove Consecutive Duplicates

Easy
0/40
Asked in companies
SAP LabsAmazonGoldman Sachs

For a given string(str), remove all the consecutive duplicate characters.

Example:
Input String: "aaaa"
Expected Output: "a"

Input String: "aabbbcc"
Expected Output: "abc"
Try solving now

2. 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’.
Try solving now
03
Round
Hard
Video Call
Duration90 minutes
Interview date17 Jun 2022
Coding problem2

I was a video interviewer taken by senior SDE. It was a tough round which involved a lot of discussions.

1. System Design Question

It was a Low Level Design problem. It was similar to an open ended problem of designing the backened APIs for generating some real world data like news feed of a social media site. It was more of a discussion around what data structure should be used to store different data according to the use case .

It can be asked to implement methods related to getting the data and to design the classes for creating objects that will be used.

Problem approach

Tip 1 : Make sure to gather all the requirements he was expecting before i started coding.
Tip 2 : It is important to have constant communication with interviewer
Tip 3 : I recommend thoroughly understanding OOPS concepts and SOLID design principles especially if you have some work experience.

2. Design Search Autocomplete System

Hard
25m average time
60% success
0/120
Asked in companies
AmazonArcesiumMicrosoft

Ninja has enrolled in a system design course at Coding Ninjas, and his first assignment is to create a search autocomplete system for a search engine.

Ninja is given ‘N’ sentences ‘SENTENCES’ and ‘N’ integers ‘TIMES’, where ‘TIMES’[i] is the number of times the ‘SENTENCES’[i] was typed. Now, the instructor will input a test sentence(at least one word and end with ‘#’). As Ninja’s best friend, can you help him with the assignment?

Your task is to implement the AutocompleteSystemclass:

  • AutocompleteSystem(String[] sentences, int[] times)Initializes the object with the sentences and times arrays.
  • List input(char c)This indicates that the user typed the character c.
    • Returns an empty array [], if c == '#' and stores the inputted sentence in the system.
    • Returns the top 3 historical hot sentences with the same prefix as the sentence already typed. If there are fewer than 3matches, return them all.

Here are the specific rules:

  • A sentence’s hot degree is defined as the number of times a user typed the same sentence before.
  • The returned top 3 hot sentences should be sorted by hot degree (The first is the hottest one). If several sentences have the same hot degree, use ASCII-code order (smaller one appears first).
  • If less than three hot sentences exist, return as many as possible.
  • When the input is a special character, it means the sentence ends, and in this case, you need to return an empty list.

For Example:

Input:
["AutocompleteSystem","input","input","input"]
[[["i want to join faang","icecream","i love coding ninjas"],[4,3,1],["i"],["s"],["#"]]

Output:
[null,["i want to join faang","icecream","i love coding ninjas"],[],[]]

Explanation:
* AutocompleteSystem obj = new AutocompleteSystem(["i want to join faang","icecream","i love coding ninjas"],[4,3,1]); 
* obj.input(“i”); // return ["i want to join faang","icecream","i love coding ninjas"]. There are three sentences that have prefix "I".
* obj.input(“s”); // return []. There is no sentence with prefix “is”
* obj.input(“#”); // return [].
Problem approach

I tried giving brute force solution but he asked me to optimise it. I gave the trie based solution and he ask me to implement it.I had to implement trie data structure and all the methods which took some time but he was convinced in the end.

Try solving now
04
Round
Medium
Video Call
Duration60 minutes
Interview date5 Apr 2022
Coding problem1

It was the Bar Raiser round.This was the last interview of the hiring process. Like always, it started with introductions of both of us. Then we had a long discussion about my work experience and projects — my contributions, learnings and challenges.

He asked me to share instances involving complex decision making and the details of actions taken. We had some technical discussions around my projects related to the tech stack and some implementation details.

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

I used BFS (level order traversal) for the same.

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