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, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Good Knowledge of Time and Space Complexity
Tip 2 : Practice DSA Questions
 

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

Tip 1 : Have some projects on your resume.
Tip 2 : Do not put false things on your resume.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 minutes
Interview date15 Sep 2021
Coding problem2

Timing - It was an online assessment, and can be given at any time based on your convenience in under 1 week's time.
Environment - Hackerrank provides indentation and hints for keywords in any language you choose like C, C++ , Java

1. Merge Two Sorted Linked Lists

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

You are given two sorted linked lists. You have to merge them to produce a combined sorted linked list. You need to return the head of the final linked list.

Note:

The given linked lists may or may not be null.

For example:

If the first list is: 1 -> 4 -> 5 -> NULL and the second list is: 2 -> 3 -> 5 -> NULL

The final list would be: 1 -> 2 -> 3 -> 4 -> 5 -> 5 -> NULL
Problem approach

Step 1) Initialize result list as empty: head = NULL.


Step 2) Let 'a' and 'b' be the heads of first and second list respectively.
 

Step 3) Reverse both the lists.
 

Step 4) While (a != NULL and b != NULL)
   a) Find the larger of two (Current 'a' and 'b')
   b) Insert the larger value of node at the front of result list.
   c) Move ahead in the list of larger node. 
 

Step 5) If 'b' becomes NULL before 'a', insert all nodes of 'a' into result list at the beginning.
 

Step 6) If 'a' becomes NULL before 'b', insert all nodes of 'b' into result list at the beginning.

Try solving now

2. 3 Sum

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

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a triplet {ARR[i], ARR[j], ARR[k]} with sum = 'K' if there exists three indices i, j and k such that i!=j, j!=k and i!=j and ARR[i] + ARR[j] + ARR[k] = 'K'.

Note:
1. You can return the list of values in any order. For example, if a valid triplet is {1, 2, -3}, then {2, -3, 1}, {-3, 2, 1} etc is also valid triplet. Also, the ordering of different triplets can be random i.e if there are more than one valid triplets, you can return them in any order.
2. The elements in the array need not be distinct.
3. If no such triplet is present in the array, then return an empty list, and the output printed for such a test case will be "-1".
Problem approach

Step 1) Traverse the array from start to end. (loop counter i)
Step 2) Create a HashMap or set to store unique pairs.
Step 3) Run another loop from i+1 to end of the array. (loop counter j)
Step 4) If there is an element in the set which is equal to x- arr[i] – arr[j], then print the triplet (arr[i],arr[j],x-arr[i]-arr[j]) and break
Step 5) Insert the jth element in the set.

Try solving now
02
Round
Easy
Video Call
Duration90 minutes
Interview date15 Oct 2021
Coding problem2

The interviewer was SDE – 2 at Amazon.
Timing - Afternoon 5:00 PM

1. Split Array Into Maximum Subarrays

Moderate
25m average time
50% success
0/80
Asked in companies
AmazonAdobeJosh Technology Group

You have given an integer array/list ‘arr’ of size ‘N’. You have to split the array into the maximum number of subarrays such that the first and last occurrence of every distinct element lies in a single subarray.

You are required to return the number of maximum subarrays in which the array can be split.

An array ‘C’ is a subarray of array ‘D’ if ‘C’ can be obtained from ‘D’ by deletion of several elements from the beginning and several elements from the end.

For Example:
Let an array ‘arr’ = [2,2,1,1].

In this example, the array can be split like this [2,2], [1,1] in this 
case the first and last occurrence of 2 lies in a first subarray and 
similarly first and the last occurrence of 1 lies in a second 
subarray. 
Problem approach

The key idea in this problem is storing the first and last occurrence index of every element. So, we can store the first and last index and then iterate over the array, and in each iteration, we check if the maximum index of the last occurrence of all the previous elements of the current subarray is less than or equal to the current index. 

 

We use array hash to store the last occurrence of an element.

Try solving now

2. Lowest Common Ancestor in a Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
GrabDisney + HotstarShareChat

You have been given a Binary Tree of distinct integers and two nodes ‘X’ and ‘Y’. You are supposed to return the LCA (Lowest Common Ancestor) of ‘X’ and ‘Y’.


The LCA of ‘X’ and ‘Y’ in the binary tree is the shared ancestor of ‘X’ and ‘Y’ that is located farthest from the root.


Note :
You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For example :
For the given binary tree

Example

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
Problem approach

Step 1) Find a path from the root to n1 and store it in a vector or array. 
Step 2) Find a path from the root to n2 and store it in another vector or array. 
Step 3) Traverse both paths till the values in arrays are the same. Return the common element just before the mismatch.

Try solving now
03
Round
Medium
HR Round
Duration45 minutes
Interview date19 Oct 2021
Coding problem1

The interviewer was the Engineering Manager at Amazon

1. Basic HR Questions

1) Tell me about a time that you failed at work
2) Tell me how you deal with ambiguity
3) Tell me about the most complex problem you have worked on

Problem approach

Tip 1 : Answer in STAR Method
Tip 2 : Don't say false things 
Tip 3 : Always relate your answer along with some examples of previous experience

Tip 4 : Emphasize on the 16 leadership principles of Amazon

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
3084 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
2294 views
1 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Amazon
1592 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
58237 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