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

Software Developer

Amazon
upvote
share-icon
4 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

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

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date17 Mar 2015
Coding problem2

This was a test round with 22 questions.

1. Check if a Linked List is a Palindrome

Easy
20m average time
90% success
0/40
Asked in companies
AmazonAppleMicrosoft

You are given a singly Linked List of integers. Your task is to return true if the given singly linked list is a palindrome otherwise returns false.

For example:
The given linked list is 1 -> 2 -> 3 -> 2-> 1-> NULL.

It is a palindrome linked list because the given linked list has the same order of elements when traversed forwards and backward​.
Follow Up:
Can you solve the problem in O(N) time complexity and O(1) space complexity iteratively?
Problem approach

A simple approach could be to use a stack. Traverse the given list and push all the nodes to a stack. Now, Traverse the list again. For every visited node, pop the topmost node from the stack and compare data of popped node with the currently visited node. If all nodes match, then the linked list is a palindrome. 
Time Complexity : O(N) 
Auxiliary Space : O(N)


A better approach would be to reverse the second half of the list. Get the middle of the linked list and reverse the second half of the linked list. 
Next, Check if the first half and second half are identical. If they are identical, return true. 
Time Complexity : O(N) 
Auxiliary Space : O(1)

Try solving now

2. Maximum of all subarrays of size k

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

You are given an array consisting of N non-negative integers, and an integer K denoting the length of a subarray, your task is to determine the maximum elements for each subarray of size K.

Note:
A subarray is a contiguous subset of an array.

The array may contain duplicate elements.

The given array follows 0-based indexing.

It is guaranteed that there exists at least one subarray of size K.
Problem approach

The problem can be solved using the concept of sliding window. 
We scan the array from 0 to n-1, and maintain a deque to keep "promising" elements. 
At each i, we keep "promising" elements, which are potassumally max number in window [i-(k-1),i] or any subsequent window. This means :

 
1. If an element in the deque and it is out of i-(k-1), we discard them. We just need to remove from the head, as we are using a deque and elements are ordered as the sequence in the array
 

2. Now only those elements within [i-(k-1),i] are in the deque. We then discard elements smaller than a[i] from the tail. This is because if a[x] 3.As a result, elements in the deque are ordered in both sequence in array and their value. At each step the head of the deque is the max element in [i-(k-1),i]
The algorithm is amortized O(n) as each element is pushed and removed once.

Try solving now
02
Round
Medium
Face to Face
Duration50 minutes
Interview date17 Mar 2015
Coding problem2

Technical Interview round with questions on DSA.

1. Kth Largest Element In An Array

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

You are given an array consisting of 'N' distinct positive integers and a number 'K'. Your task is to find the kth largest element in the array.

Example:
Consider the array {2,1,5,6,3,8} and 'K' = 3, the sorted array will be {8, 6, 5, 3, 2, 1}, and the 3rd largest element will be 5.
Note:
1) Kth largest element in an array is the kth element of the array when sorted in non-increasing order. 

2) All the elements of the array are pairwise distinct.
Problem approach

To solve the question using a max heap, make a max heap of all the elements of the list. Run a loop for k-1 times and remove the top element of the heap. After running the loop, the element at top will be the kth largest element, return that. Time Complexity : O(n + klogn)


The question can also be solved using a min heap. 
 

Approach :


1. Create a min heap class with a capacity of k.
 

2. When the heap reaches capacity eject the minimum number. 
 

3. Loop over the array and add each number to the heap. 
 

4. At the end, the largest k number of elements will be left in the heap, the smallest of them being at the top of the heap, which is the kth largest number.
 

The time complexity for this solution is O(N*log(K)).

Try solving now

2. Level Order Traversal In Spiral form

Easy
20m average time
75% success
0/40
Asked in companies
PayUAtlassianAmazon

You have been given a binary tree of 'N' nodes. Print the Spiral Order traversal of this binary tree.

For example
For the given binary tree [1, 2, 3, -1, -1, 4, 5, -1, -1, -1, -1]
    1
   / \
  2   3
     / \
    4   5

Output: 1 3 2 4 5
Problem approach

To print the nodes in spiral order, nodes at different levels should be printed in alternating order. An additional Boolean variable ltr is used to change printing order of levels. If ltr is 1 then printGivenLevel() prints nodes from left to right else from right to left. Value of ltr is flipped in each iteration to change the order.

 

Function to print level order traversal of tree : 

printSpiral(tree)
	bool ltr = 0;
	for d = 1 to height(tree)
		printGivenLevel(tree, d, ltr);
	ltr ~= ltr /*flip ltr*/
Try solving now
03
Round
Easy
Face to Face
Duration45 minutes
Interview date17 Mar 2015
Coding problem1

This was the last technical Interview round.

1. 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]
Problem approach

A simple approach would be to create a new arrays with size as sum of the sizes of both the arrays. Copy the elements of both the arrays in the new array and sort the array. 
A space optimised approach also exists. While traversing the two sorted arrays parallelly, if we encounter the jth second array element is smaller than ith first array element, then jth element is to be included and replace some kth element in the first array. 

Algorithm :


1) Initialize i,j,k as 0,0,n-1 where n is size of arr1 
 

2) Iterate through every element of arr1 and arr2 using two pointers i and j respectively
if arr1[i] is less than arr2[j]
increment i
else
swap the arr2[j] and arr1[k]
increment j and decrement k

3) Sort both arr1 and arr2

Try solving now
04
Round
Easy
HR Round
Duration30 minutes
Interview date17 Mar 2015
Coding problem1

HR round with typical behavioral problems.

1. Basic HR Questions

1. Introduction
2. Why Amazon?

Problem approach

Tip 1 : The cross questioning can go intense some time, think before you speak.

Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.

Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round, like what are the projects currently the company is investing, which team you are mentoring. How all is the work environment etc.

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 Developer
2 rounds | 4 problems
Interviewed by Amazon
1117 views
0 comments
0 upvotes
company logo
Software Developer
3 rounds | 5 problems
Interviewed by Amazon
1147 views
0 comments
0 upvotes
company logo
Software Developer
2 rounds | 4 problems
Interviewed by Amazon
1033 views
0 comments
0 upvotes
company logo
Software Developer
3 rounds | 6 problems
Interviewed by Amazon
970 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Developer
5 rounds | 14 problems
Interviewed by Microsoft
4029 views
1 comments
0 upvotes
company logo
Software Developer
6 rounds | 12 problems
Interviewed by SAP Labs
2912 views
0 comments
0 upvotes
company logo
Software Developer
4 rounds | 6 problems
Interviewed by SAP Labs
1075 views
0 comments
0 upvotes