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

Software Engineer

Amazon
upvote
share-icon
3 rounds | 15 Coding problems

Interview preparation journey

expand-icon
Journey
Amazon is guided by four principles: customer obsession rather than competitor focus, passion for invention, commitment to operational excellence, and long-term thinking. The company came to our college for the profile of Software Engineer. It conducted three rounds: an online test, Technical Interview 1, and Technical Interview 2. Around 500 students participated in the drive, out of which 12 students were selected.
Application story
It was an on-campus drive. The company came to our college for the position of Software Engineer. It conducted three rounds: an Online Test, Technical Interview 1, and Technical Interview 2. Around 500 students participated in the drive, out of which 12 students were selected.
Why selected/rejected for the role?
I was rejected for this role after Technical Interview-1, as the interviewer asked 2 coding questions during the interview. I could solve only one, so, I was rejected for this role.
Preparation
Duration: 6 months
Topics: Data Structures, Advanced Coding Questions, Operating System, System Design, Reasoning Questions
Tip
Tip

Tip 1: Practice advanced level coding questions for test and interview.
Tip 2: Study data structures in detail.

Application process
Where: Campus
Eligibility: 6.5 CGPA
Resume Tip
Resume tip

Tip 1: Have strong projects in resume.
Tip 2: Mention coding rank of coding platforms if any.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration145 minutes
Interview date11 Nov 2021
Coding problem7

This round was conducted on Vitapowered platform and it had 62 questions. The workstyle assessment questions were not technical, it was just for checking how suitable the candidate is for the position.

1. Min Jumps

Easy
15m average time
85% success
0/40
Asked in companies
AckoHSBCIBM

You live in a Ninja town which is in the form of a N * M grid. In this town, people travel from one place to another by jumping over the buildings which are present in each cell of the grid. It is Christmas eve, and Santa wants to give gifts and chocolates to the kids who live in the building which is present at the cell (N - 1, M - 1). Initially, Santa is present on cell (0, 0). Since Santa is in a hurry, help him find a path from starting point to the endpoint with the least amount of time.

The Santa may go only from one building to any of its adjacent buildings which is present either to the right or to the bottom or bottom right cell i.e. if the current position is (x, y), he may go to (x + 1, y + 1) or (x + 1, y) or (x, y + 1) given that the new coordinates are in the grid. The time taken to reach from one building to another is equal to the absolute difference between the heights of buildings.

Note:

1. The heights of the buildings are positive.
2. Santa starts from the cell (0, 0) and he has to reach the building (N - 1, M - 1).
3. Santa cannot leave the grid at any point of time.
Problem approach

We use a greedy approach as follows:
Step 1: Start from the first index and keep track of the maximum index you can reach based on the current element's value. 
Step 2: As you iterate through the array, update the maximum reachable index at each step. 
Step 3: If at any point the current index surpasses the maximum reachable index, you know you cannot reach the last index, and you can return False. 
Step 4: However, if you successfully reach the last index or go beyond it, you can return True as you have successfully reached the end of the array.

Try solving now

2. Maximum Consecutive Ones

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

Given a binary array 'ARR' of size 'N', your task is to find the longest sequence of continuous 1’s that can be formed by replacing at-most 'K' zeroes by ones. Return the length of this longest sequence of continuous 1’s.

Problem approach

We use a sliding window approach as follows: 
Step 1: Initialize two pointers, left and right, both starting at index 0. 
Step 2: Maintain a count of the number of zeroes encountered within the current window. 
Step 3: While the count of zeroes remains less than or equal to B, expand the window by moving the right pointer to the right. 
Step 4: If the count of zeroes exceeds B, move the left pointer to the right while reducing the count of zeroes until the window is valid again. 
Step 5: Keep track of the maximum window size and the corresponding start index.

Try solving now

3. N-th Fibonacci Number

Moderate
40m average time
70% success
0/80
Asked in companies
HCL TechnologiesHCL TechnologiesOracle

You are given an integer ‘N’, your task is to find and return the N’th Fibonacci number using matrix exponentiation.

Since the answer can be very large, return the answer modulo 10^9 +7.

Fibonacci number is calculated using the following formula:
F(n) = F(n-1) + F(n-2), 
Where, F(1) = F(2) = 1.
For Example:
For ‘N’ = 5, the output will be 5.
Problem approach

Tip 1: Practice function writing or error finding code questions
Tip 2: Read the question carefully

Try solving now

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

Tip 1: Practice function writing or error finding code questions
Tip 2: Read the question carefully

Try solving now

5. Puzzle

B2CD, _____, BCD4, B5CD, BC6D

Problem approach

Tip 1: Practice logical reasoning questions.
Tip 2: Keep pen and paper by your side.

6. Puzzle

Though the waste of time or the expenditure on fashions is very large, yet fashions have come to stay. They will not go, come what may. However, what is now required is that strong efforts should be made to displace the excessive craze for fashion from the minds of these youngsters.
The passage best supports the statement that:

Problem approach

Tip 1: Practice logical reasoning questions
Tip 2: Keep pen and paper by your side

7. Puzzle

Pointing to a photograph, a man said, "I have no brother, and that man's father is my father's son." Whose photograph was it?

Problem approach

Tip 1: Practice logical reasoning questions
Tip 2: Keep pen and paper by your side

02
Round
Hard
Video Call
Duration60 minutes
Interview date23 Nov 2021
Coding problem4

This was a 1-hour long interview, but everything depends on how fast you can solve coding questions in interview. The major focus is on coding questions.

1. Check Whether Binary tree Is Complete

Moderate
25m average time
70% success
0/80
Asked in companies
WalmartSamsung R&D InstituteAmazon

You are given a binary tree. Your task is to check whether the given binary tree is a Complete Binary tree or not.

A Complete Binary tree is a binary tree whose every level, except possibly the last, is completely filled, and all nodes in the last level are placed at the left end.

Example of a complete binary tree :

Example

Try solving now

2. Stack using queue

Moderate
25m average time
65% success
0/80
Asked in companies
AmazonQualcommPhilips

Implement a Stack Data Structure specifically to store integer data using two Queues.


There should be two data members, both being Queues to store the data internally. You may use the inbuilt Queue.


Implement the following public functions :

1. Constructor:
It initializes the data members(queues) as required.

2. push(data) :
This function should take one argument of type integer. It pushes the element into the stack and returns nothing.

3. pop() :
It pops the element from the top of the stack and, in turn, returns the element being popped or deleted. In case the stack is empty, it returns -1.

4. top :
It returns the element being kept at the top of the stack. In case the stack is empty, it returns -1.

5. size() :
It returns the size of the stack at any given instance of time.

6. isEmpty() :
It returns a boolean value indicating whether the stack is empty or not.
Operations Performed on the Stack:
Query-1(Denoted by an integer 1): Pushes an integer data to the stack. (push function)

Query-2(Denoted by an integer 2): Pops the data kept at the top of the stack and returns it to the caller. (pop function)

Query-3(Denoted by an integer 3): Fetches and returns the data being kept at the top of the stack but doesn't remove it, unlike the pop function. (top function)

Query-4(Denoted by an integer 4): Returns the current size of the stack. (size function)

Query-5(Denoted by an integer 5): Returns a boolean value denoting whether the stack is empty or not. (isEmpty function)
Example
Operations: 
1 5
1 10
2
3
4

Enqueue operation 1 5: We insert 5 at the back of the queue.
  Queue: [5]

Enqueue operation 1 10: We insert 10 at the back of the queue.
  Queue: [5, 10]

Dequeue operation 2: We remove the element from the front of the queue, which is 5, and print it.
  Output: 5
  Queue: [10]

Peek operation 3: We return the element present at the front of the queue, which is 10, without removing it.
  Output: 10
  Queue: [10]

IsEmpty operation 4: We check if the queue is empty.
  Output: False
  Queue: [10]
Problem approach

Step 1: Initialize two queues, let's call them queue1 and queue2.
Step 2: For the push operation, simply enqueue the element into queue1.
Step 3: For the pop operation:
a. While there are elements in queue1 except the last one, dequeue from queue1 and enqueue into queue2.
b. Dequeue the last element from queue1 (this is the element to be popped).
Step 4: Swap the names of queue1 and queue2 to maintain the consistency of the operations. This ensures that queue1 always contains the elements in the order they were pushed.
Step 5: For the top operation, you can peek at the front element of queue1 (which is the top element of the stack).

Try solving now

3. OS Question

What is deadlock? What are the necessary conditions to achieve deadlock? (Learn)

Problem approach

Tip 1: Hear the question carefully.
Tip 2: Study deadlock in operating system.

4. Python Question

What is slicing in Python? (Learn)

Problem approach

Tip 1: Hear the question carefully
Tip 2: Study slicing in Python

03
Round
Hard
Video Call
Duration60 minutes
Interview date7 Dec 2021
Coding problem4

This interview was almost same as first interview, a 1 hour long. The major focus is on coding questions.

1. DBMS Question

What are different types of JOINS in SQL? (Learn)

Problem approach

Tip 1: Study JOINS in SQL
Tip 2: Hear the question carefully

2. Python Question

Explain the difference between split() and join() functions in Python. (Learn)

Problem approach

Tip 1: Study string functions in Python.
Tip 2: Hear the question carefully.

3. Infix To Postfix

Easy
20m average time
80% success
0/40
Asked in companies
DelhiveryOracleExpedia Group

You are given a string 'exp' which is a valid infix expression.


Convert the given infix expression to postfix expression.


Note:
Infix notation is a method of writing mathematical expressions in which operators are placed between operands. 

For example, "3 + 4" represents the addition of 3 and 4.

Postfix notation is a method of writing mathematical expressions in which operators are placed after the operands. 

For example, "3 4 +" represents the addition of 3 and 4.

Expression contains digits, lower case English letters, ‘(’, ‘)’, ‘+’, ‘-’, ‘*’, ‘/’, ‘^’. 


Example:
Input: exp = ‘3+4*8’

Output: 348*+

Explanation:
Here multiplication is performed first and then the addition operation. Hence postfix expression is  3 4 8 * +.


Problem approach

Step 1: Initialize an empty stack to hold operators temporarily.

Step 2: Initialize an empty string to hold the postfix expression.

Step 3: Iterate through the infix expression from left to right.

Step 4: If the current character is an operand (numeric value or variable), add it to the postfix expression.

a) If the current character is an operator (+, -, *, /, etc.), pop and append operators from the stack to the postfix expression while their precedence is greater than or equal to the precedence of the current operator and the top of the stack is not an opening parenthesis.

b) Push the current operator onto the stack.

c) If the current character is an opening parenthesis '(', push it onto the stack.

Step 5: If the current character is a closing parenthesis ')', pop and append operators from the stack to the postfix expression until an opening parenthesis '(' is encountered. Pop and discard the opening parenthesis.

Step 6: After processing all characters, pop and append any remaining operators from the stack to the postfix expression.

Step 7: The resulting string will be the postfix expression.

Try solving now

4. Cycle Detection in a Singly Linked List

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

You are given a Singly Linked List of integers. Return true if it has a cycle, else return false.


A cycle occurs when a node's next points back to a previous node in the list.


Example:
In the given linked list, there is a cycle, hence we return true.

Sample Example 1

Problem approach

Step 1: Initialize an empty hash table (or set) to store visited nodes.

Step 2: Traverse the list, one node at a time: a) For each node, check if it exists in the hash table. If it does, return True, as a cycle is detected. b) If the node is not in the hash table, add it to the hash table and move to the next node.

Step 3: If you reach the end of the list without encountering a node that is already in the hash table, return False, as no cycle is detected.

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
Software Engineer
3 rounds | 5 problems
Interviewed by Amazon
3674 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
0 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 6 problems
Interviewed by Amazon
0 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
2806 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7977 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
10148 views
1 comments
0 upvotes
company logo
Software Engineer
3 rounds | 4 problems
Interviewed by Samsung
2937 views
0 comments
0 upvotes