Common Amazon Coding Interview Questions
Coding interviews are challenging, especially if it comes to big tech companies like Amazon. Amazon composes its technical interviews of coding interviews and system design interviews. Amazon coding interviews are hard, they are specific to Amazon. Amazon base coding interviews on data structures and algorithms problems.
You are given a coding question and expected to solve it with clean code in a short time while someone scrutinizes every keystroke that you make. So, communicate your thought process in the interview  think out loud.
May it seem impossible for you to think, code, and communicate at the same time. (Sometimes even the candidates with excellent coding skills may fail the coding interview.) But you can improve your coding interview skills and overcome it. Interviewing is a skill and you can get better at that skill by preparing and practicing for it.
Proper preparation is a must if you want to crack the Amazon coding interview.
In this article, I’ll provide the most common Amazon coding questions. Also, will give you preparation tips that will help you ace the Amazon coding interview.
Here’s what we’ve covered:

Amazon interview process

Amazon coding interview questions

Preparation tips for coding round
1. Amazon interview process
The Amazon interview process differs from other FAANG companies’ interviews process by their behavioral interviews. Amazon bases its behavioral interview on 16th leadership principles. That’s what makes it unique.
Here’s what you can expect through the Amazon interview process:
 HR recruiter email or call
 Online assessment  the first interview round is the Amazon coding challenge
 Telephonic round: one to two interviews ( questions in a range from arrays, trees to dynamic programming problems).
 Onsite The Loop: four to six interviews (tests your core problem solving, system design, and leadership capabilities)
2. Amazon coding interview questions
Here are the most common Amazon question types:
 Graphs / Trees (48% of questions, most frequent)
 Arrays / Strings (36%)
 Linked lists (9%)
 Search / Sort (3%)
 Stacks & Queues (2%, least frequently)
 Hash tables (2% of questions, least frequently)
2.1. Coding interview questions
I’ll provide some examples of Amazon coding interview questions below:
 Find a missing number in the array
 Determine If the sum of two integers is equal to the given value
 Copy linked list with arbitrary pointer
 Implement a segment tree range sum query problem with an update.
 Prove that the time complexity of the build heap function in heap sort is o(n).
 Print all the node data a distance of k from a given node in a binary tree.
 Given two integer arrays A and B of size N.
There are N gas stations along a circular route, where the amount of gas at station i is A[i].
You have a car with an unlimited gas tank and it costs B[i] of gas to travel from station i.
to its next station (i+1). You begin the journey with an empty tank at one of the gas stations.
Return the minimum starting gas station’s index if you can travel around the circuit once, otherwise return 1.
You can only travel in one direction. i to i+1, i+2, … n1, 0, 1, 2.. Completing the circuit means starting at I and ending up at I again.
Input Format
The first argument given is the integer array A.
The second argument given is the integer array B.
Output Format
Return the minimum starting gas station’s index if you can travel around the circuit once, otherwise return 1.
 Problem Description
A message containing letters from AZ is being encoded to numbers using the following mapping:
‘A’ > 1
‘B’ > 2
…
‘Z’ > 26
Given an encoded message A containing digits, determine the total number of ways to decode it modulo 109 + 7.
Problem Constraints
1 <= A <= 105
Input Format
The first and the only argument is a string A.
Output Format
Return a single integer, denoting the total number of ways to decode it modulo 109 + 7.
 Given a binary tree T, find the maximum path sum.
The path may start and end at any node in the tree.
Input Format:
The first and the only argument contains a pointer to the root of T, A.
Output Format:
Return an integer representing the maximum sum path.
Constraints:
1 <= Number of Nodes <= 7e4
1000 <= Value of Node in T <= 1000
 Given an array of nonnegative integers, A, you are initially positioned at the 0th index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you can reach the last index.
Input Format:
The first and the only argument of input will be an integer array A.
Output Format:
Return an integer, representing the answer as described in the problem statement.
=> 0: If you cannot reach the last index.
=> 1: If you can reach the last index.
Constraints:
1 <= len(A) <= 106
0 <= A[i] <= 30
 Problem Description
Given an array of size n, find the majority element. The majority element is the element that appears more than floor(n/2) times.
You may assume that the array is nonempty and the majority element always exists in the array.
 Given a singly linked list
L: L0 → L1 → … → Ln1 → Ln,
reorder it to:
L0 → Ln → L1 → Ln1 → L2 → Ln2 → …
You must do this in place without altering the nodes’ values.
For example,
Given {1,2,3,4}, reorder it to {1,4,2,3}.
3. Preparation tips for coding round
The competition in Amazon interviews will be very high and tough. Coding is the most challenging round in the interview. So, we should start our journey from Leet Code.
3.1 Prepare for data structure and algorithm problem solving
I’ll list the major topics to prepare, first:
Major preparation topics
 Arrays and string
 LinkedList
 Stack
 Binary search
 Tree and graphs
 Backtracking(Not a big fan !)
 Sorting and searching
 Dynamic Programming
 Sliding window
 Priority Queue and Hashmap
So, give yourself 23 days on each topic and try to solve the easy and medium questions from each one. Solve the problems that were asked in the last six months. Practice that for 2  3 weeks, and then try to solve problems in under 30 minutes.
If you have enough time, try to solve at least 50 of the interview questions asked in the last six months. If you don’t have time, then at least look at the solution and try to understand the problem. I highly recommend practicing as much as you can. Also, InterviewHelp allows you to have mock interviews and get real feedback to improve.
Schedule your free consultation today
Tips:
 Read the problem. Ask clarifying questions after that and clear out the expectations like do they need unit test cases and is there a followup question as well. You should plan your time accordingly.
 Come up with a solution in the next few minutes. (It can brute force the solution as well).
 Thinking out loud  it’s important to communicate your thinking process.
 Verify with the interviewer if your approach is correct. Discuss with the interviewer if you have multiple approaches in mind.
 Practice writing clean and optimized code.
 Mention the time complexity of the solution.
 If the interviewer is happy with the approach, move on with the coding part and communicate throughout.
 Make sure you are handling edge cases and boundary conditions.
 Dry run your solution against one of the test cases to find out any bugs in your code.
 Listen to the interviewer; they may give hints in case you are going in the wrong direction
You should also learn about Amazon’s leadership principles and prepare for system design.
See also:
Additional general interview tips:
 Be sincere
 Be confident
 Be clear
 Prompt on time
 Prepare a suitable set of questions for the interviewer
 Prepare for general HR questions like “tell me about a time….”
 Be clear on your CV
Ask for preparation days, talk with recruiters before the onsite round, and ask for the expectations in each round. Also, ask for feedback even if you are rejected because it can help you in future interviews. Remember, practice and consistency are the keys to success. Give mock interviews before your actual interviews.
Schedule your first mock interview now
I hope this helps. Good luck with your next Amazon interview!