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

SDE - 1

Amazon
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 2 months
Topics: Data Structures, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practice different types of questions
Tip 2 : Be honest while preparing
Tip 3 : Be clear with your topics

Application process
Where: Referral
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Be honest with your resume
Tip 2 : Be smart with your resume

Interview rounds

01
Round
Easy
Online Coding Test
Duration60 minutes
Interview date12 Jan 2021
Coding problem2

The round was scheduled for 5 days and we can take the test anytime as per the convenience.

1. Count with K different characters

Moderate
15m average time
85% success
0/80
Asked in companies
AmazonWalmartCIS - Cyber Infrastructure

You are given a string 'str' of lowercase alphabets and an integer 'k' .


Your task is to return the count all the possible substrings that have exactly 'k' distinct characters.


For example:

'str' = abcad and 'k' = 2. 

We can see that the substrings {ab, bc, ca, ad} are the only substrings with 2 distinct characters. 

Therefore, the answer will be 4.    
Problem approach

The problem can be solved in O(n*n). Idea is to maintain a hash table while generating substring and checking the number of unique characters using that hash table.

Try solving now

2. Inorder Sucessor

Moderate
30m average time
65% success
0/80
Asked in companies
InnovaccerAmazonIntuit

You have been given an arbitrary binary tree and a node of this tree. You need to find the inorder successor of this node in the tree.

The inorder successor of a node in a binary tree is that node that will be visited immediately after the given node in the inorder traversal of the tree. If the given node is visited last in the inorder traversal, then its inorder successor is NULL.

The inorder traversal of a binary tree is the traversal method in which for any node its left subtree is visited first, then the node itself, and then the right subtree.

Note
1. Each node is associated with a unique integer value. 

2. The node for which the successor is to be found is guaranteed to be part of the tree.
Problem approach

1. If the right subtree of node is not NULL, then succ lies in right subtree. - Go to right subtree and return the node with minimum key value in the right subtree.
2. If right subtree of node is NULL, then start from the root and use the search-like technique. - Travel down the tree, if a node’s data is greater than root’s data then go right side, otherwise, go to left side.

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date19 Jan 2021
Coding problem2

It was an afternoon round and the interviewers were friendly and supportive.

1. Single Element in a Sorted Array

Easy
15m average time
85% success
0/40
Asked in companies
AmazonOlaLenskart.com

You are given a sorted array ‘arr’ of ‘n’ numbers such that every number occurred twice in the array except one, which appears only once.


Return the number that appears once.


Example:
Input: 'arr' = [1,1,2,2,4,5,5]

Output: 4 

Explanation: 
Number 4 only appears once the array.


Note :
Exactly one number in the array 'arr' appears once.


Problem approach

An Efficient Solution can find the required element in O(log n) time. The idea is to use Binary Search.
All elements before the required have the first occurrence at even index (0, 2, ..) and the next occurrence at odd index (1, 3, …). And all elements after the required elements have the first occurrence at an odd index and the next occurrence at an even index. 
1) Find the middle index, say ‘mid’.
2) If ‘mid’ is even, then compare arr[mid] and arr[mid + 1]. If both are the same, then the required element after ‘mid’ and else before mid.
3) If ‘mid’ is odd, then compare arr[mid] and arr[mid – 1]. If both are the same, then the required element after ‘mid’ and else before mid.

Try solving now

2. Merge Two Sorted Arrays

Moderate
15m average time
85% success
0/80
Asked in companies
HSBCHikeAmazon

Ninja has been given two sorted integer arrays/lists ‘ARR1’ and ‘ARR2’ of size ‘M’ and ‘N’. Ninja has to merge these sorted arrays/lists into ‘ARR1’ as one sorted array. You may have to assume that ‘ARR1’ has a size equal to ‘M’ + ‘N’ such that ‘ARR1’ has enough space to add all the elements of ‘ARR2’ in ‘ARR1’.

For example:

‘ARR1’ = [3 6 9 0 0]
‘ARR2’ = [4 10]
After merging the ‘ARR1’ and ‘ARR2’ in ‘ARR1’. 
‘ARR1’ = [3 4 6 9 10]
Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date29 Jan 2021
Coding problem1

It was an evening round.

1. Linked List to binary Tree

Easy
15m average time
80% success
0/40
Asked in companies
AmazonOYOFlipkart limited

Given a linked list containing N nodes where each node is associated with a certain value. The list is the representation of the level order traversal of a binary tree, you need to construct a complete binary tree from the given list and return its root.

Note
1. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes at the last level are as far left as possible.
2. All the node values are positive.
3. The size of the linked list is greater than 1.
4. The end of the linked list is represented by -1.
Problem approach

Think about which data structure to be used to traverse binary tree in spiral order. The idea is to use a direction variable and decide whether to pop elements from the front or from the rear based on the value of this direction variable.

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