Background
I would like to share my Amazon interview experience with everyone to help others who are preparing for Amazon interviews. I went through multiple rounds of interviews and was ultimately rejected in the fourth round, which came as a surprise to me, as I had put in a lot of effort preparing for the interviews. I submitted my job application in November 2024 and received an online assessment on January 6, 2025.
OA
The assessment format is similar to Amazon’s standard OA, including two data structure and algorithm (DSA) questions (medium to difficult). I successfully optimized and solved the two DSA questions and completed the behavioral interview section. I passed the OA smoothly.
The Interview Process
Round 1:DSA
Q1: Subarrays with sum equal to k
Given an integer array nums and an integer k, count and return the number of subarrays in the array whose sum is equal to k. A subarray is a contiguous non-empty sequence of elements in the array.
My approach is to construct prefix sums during the iteration process. Initialize {0:1} and set the position corresponding to index=0 to 1. Use a dictionary to record the number of occurrences of each prefix sum. Calculate whether the value of cur_sum – k exists. Store the results of existing prefix sums and their frequencies in a hash dictionary, trading space for time.
Q2: Searching in a rotated sorted array, subsequent questions involve time complexity
Given an array where nums[0]..nums[k] and nums[k+1]…nums[n] are both in ascending order, and nums[n] < nums[0]. Given a target number, return the index in nums; if it does not exist, return -1
This is a special binary search problem that requires consideration of the sequence in which nums[mid] is located. I have divided it into two cases for discussion: the first case is an ascending sequence, and the second case is two ascending sequences.
Round 2:DSA
Q1: Minimum Descending Path Sum
From the top-left corner to the bottom-right corner of an m × n grid, find the path with the minimum sum. Each move can only be one step to the right or one step down.
My approach is to use dynamic programming (DP). Initialize the value at the top-left corner. For each cell, the minimum path sum is the minimum of the sum of the paths coming from above and from the left, plus the value of the current cell.
Q2: Rotten Oranges
This problem requires a queue. Add the coordinates of all rotten oranges to the queue, and process all rotten oranges in the queue every minute.
My approach is to iterate through the oranges on the map, record the number of fresh oranges (to verify if all have rotted), and push all rotten oranges into the queue. Use BFS to process all directions of oranges in the queue within one minute. If the number of fresh oranges is 0, return the time.
Note that you must first check if the orange is within the map before checking if it is rotten; doing it the other way around will cause an out-of-bounds error.
Round 3:Behavioral
The questions I was asked:
Q1: Describe a time when a project you were responsible for received criticism.
Q2: A project you have analyzed and discussed in depth.
Q3: How did you solve the problem when data was unavailable?
The behavioral interview focused on LP (leadership principles). I learned about Amazon’s leadership principles in advance and prepared corresponding stories, so I was very confident in my answers to the standard LP questions in Amazon’s exam preparation materials.
Round 4:DSA
Q1: Nodes in a binary tree that are k units apart
Here, I used two methods: in-order traversal and double pointer search.
In-order traversal: Perform an in-order traversal on the BST to obtain an ordered list of node values.
Double pointer search: In the ordered list, use the double pointer method to find two numbers whose sum is K.
Q2: The nearest LCA in a binary tree
For this problem, I used a recursive approach. If the current node is null, return false directly. Recursively process the left and right subtrees using a postorder traversal, and determine whether the left and right subtrees contain nodes p or q. Determine whether the current node is p or q, and combine the return values of the left and right subtrees to determine whether the common ancestor has been found.
Interview Summary & Suggestions
I was very disappointed when I received the rejection email two days later. When I asked for feedback, they mentioned that I needed to improve my problem-solving skills. This feedback was difficult for me to accept because I thought I had answered all the questions well in all rounds. I was confident that I would pass the interview, but things did not go as planned. I don’t know the real reason for the rejection, but I want to share this experience so that future interviewees can be prepared. If you encounter any difficulties or have any questions during the interview, feel free to come here to find solutions.