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)

Master the SDE Interview - Expert Tips and Advice to Land Your Dream Job. Get it for Free! Limited Time Offer

"This guide is a game-changer for anyone looking to break into the software development industry. The expert tips and advice helped me land a job as an SDE at a top tech company. Highly recommend!" - Sarah, Software Development Engineer

Download Your Expert SDE Interview Guide

2. Amazon coding interview questions

Here are the most common Amazon question types:

  1. Graphs / Trees (48% of questions, most frequent)
  2. Arrays / Strings (36%)
  3. Linked lists (9%)
  4. Search / Sort (3%)
  5. Stacks & Queues (2%, least frequently)
  6. 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, … n-1, 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 A-Z 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.


1 <= Number of Nodes <= 7e4

-1000 <= Value of Node in T <= 1000

  • Given an array of non-negative 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.


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 non-empty and the majority element always exists in the array.

  • Given a singly linked list

L: L0 → L1 → … → Ln-1 → Ln,

reorder it to:

L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → …

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

  1. Arrays and string
  2. LinkedList
  3. Stack
  4. Binary search
  5. Tree and graphs
  6. Backtracking(Not a big fan !)
  7. Sorting and searching
  8. Dynamic Programming
  9. Sliding window
  10. Priority Queue and Hashmap

So, give yourself 2-3 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.

Ace Your Coding Interview at Top Tech Companies

View Our Course For SDE Interview Preparation


  1. Read the problem. Ask clarifying questions after that and clear out the expectations like do they need unit test cases and is there a follow-up question as well. You should plan your time accordingly.
  2. Come up with a solution in the next few minutes. (It can brute force the solution as well).
  3. Thinking out loud - it’s important to communicate your thinking process.
  4. Verify with the interviewer if your approach is correct. Discuss with the interviewer if you have multiple approaches in mind.
  5. Practice writing clean and optimized code.
  6. Mention the time complexity of the solution.
  7. If the interviewer is happy with the approach, move on with the coding part and communicate throughout.
  8. Make sure you are handling edge cases and boundary conditions.
  9. Dry run your solution against one of the test cases to find out any bugs in your code.
  10. 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

Click to Schedule

I hope this helps. Good luck with your next Amazon interview!

comments powered by Disqus