# Amazon Interview Questions

Amazon is a tech behemoth that has disrupted several industries through innovation and technology. The company�s services span e-commerce, digital streaming, aerospace, computing, and AI, giving prospective employees incredible opportunities for innovation and growth.

Unsurprisingly, Amazon attracts a wellspring of talent, receiving thousands of resumes every year for engineering and other roles. Its interview process, as one would expect, is significantly difficult to crack. Only about 2% of those who apply get through, highlighting the rigorous nature of its hiring process.

If you are intent on acing Amazon�s coding interview, you must adopt the right strategy. Without that, beating the stiff competition is an uphill climb.

In this article, we�ll look at the type of interview questions you can expect at Amazon:

- What Is Unique About Amazon�s Interview Process?
- The Amazon Interview Process
- Amazon Interview Questions
- Tips to Crack the Amazon Interview

**What Is Unique About Amazon�s Interview Process?**

For the most part, Amazon interview process is similar to other FAANG companies. However, they have a couple of key rounds or methods that make the interview process unique.

**The Loop**

The Loop is Amazon onsite interview � it is centered around the company�s 14 leadership principles. Recruiters evaluate you against these leadership principles either directly or indirectly, at any stage of the on-site.

**The Bar Raiser**

Amazon also has a special �Bar Raiser� round, where specially trained employees (known as Bar Raisers) gauge if you�re the right fit. The primary function of the �Bar Raisers� is to maintain the hiring bar high by seeking out only the best talent. They have a decisive say in the interview�s outcome; so even if you ace the core technical rounds, you have to pass the bar raiser round to lock an offer.

## ?**The Amazon Interview Process**

The Amazon technical interview has three main stages:

- The initial phone screen
- The Amazon coding assignment
- The Loop

Let�s look at what happens in each of these rounds:

**1. The Initial Phone Screen**

This round happens with a recruiter from Amazon who will get in touch with you after your profile gets provisionally shortlisted for the role. The recruiter will ask you questions around your experience, core skills, and expectations from the role.

You can also expect a couple of behavior-related questions in this round. At the end of the interview, the recruiter will set a date for the coding assignment.

For more details on Amazon phone questions and how to answer them, check out the *�**Amazon Phone Interview Questions**�* article.

**2. The Amazon Coding Assignment**

Depending on the role you�re applying to, the coding assignment happens either remotely or in-person. For most developer positions, the coding assignment happens remotely. Considering the pandemic situation, Amazon decided that it will hold remote assignments that will be monitored in real time.

The coding assignment involves solving 1-2 coding problems within a stipulated time period. It usually happens on a coding interview platform or a Google Doc. The hiring manager evaluates your approach to solving the problems and how you go about arriving at the solution. At the end of the assignment, expect a few questions around the concepts you employed to solve the problem(s).

If your performance in the coding assignment is satisfactory, a recruiter will get in touch with you to fix a date for the on-site interview.

**3. The Loop**

Amazon�s on-site interview, known as the Loop, is the final phase in the hiring process. Getting through this stage is significantly challenging as recruiters assess you on a number of aspects before making a hiring decision.

The loop typically consists of the following rounds:

**Coding round:**This round involves solving 1-2 coding problems around algorithms and data structures. The extent of your problem-solving skills is assessed in this round.**Design round:**Hiring managers in this round evaluate your engineering design skills. Your ability to design and work with scalable systems with low latency is assessed.**Behavioral round:**Behavioral interviews at Amazon are based on the company�s 14 leadership principles. The behavioral round is essentially built to test if your attitude and personality traits align with the company�s vision and goals.**The bar-raiser round:**Bar raisers are a group of handpicked employees trained to maintain the hiring bar at Amazon. Their primary role is to find the best candidates for the role by assessing them against a set of predefined parameters. Bar raisers have a veto when recruiters make a hiring decision. If they happen to deem you unfit for the role, you don�t get offered.

Note:Amazon tends to focus more on behavioral and design interviews for senior positions, and coding interviews for junior positions. Additionally, coding interviews don�t have a veto while hiring for senior positions but design interviews have a veto for junior positions.

**Amazon Interview Questions**

Amazon asks interview questions around algorithms and data structures. In the below sections, we look at questions from topics that feature in Amazon�s tech interview.

**Amazon Interview questions on Arrays**

Arrays are a popular data structure around which questions are asked in technical interviews. Below are some common interview questions on arrays:

**Given:**Array A of size N**Task:**Perform operations such as searching an element, inserting an element, and deleting an element by completing the functions. Also, all functions should return a boolean value**Given:**Array A of size N**Task:**Print elements of A in alternate order (starting from index 0)**Task:**Write a code to find the minimum and maximum element in an array**Given:**Array Arr of size N**Task:**Print the second largest element from the array**Given:**Array A of size N of integers**Task:**Find the minimum and maximum elements in the array**Given:**An unsorted array arr[] of size N**Task:**Rotate it by D elements (clockwise)**Given:**A sorted array A of size N**Task:**Delete all duplicate elements from A**Given:**An unsorted array arr[] of n positive integers**Task:**Find the number of triangles that can be formed with three different arrays elements if the elements were lengths of the three sides of the triangle.**Given:**An array A of positive integers**Task:**Find the leaders in the array (an element is a leader if it is greater than or equal to all the elements to its right)**Given:**An array A of N elements**Task:**Find minimum index-based distance between two elements, x and y**Given:**An array A of N integers**Task:**Find any 3 elements in it such that A[i] < A[j] < A[k] and i < j < k**Given:**An array A of N elements**Task:**Find the majority element in the array (a majority element in an array A of size N is an element that appears more than N/2 times in the array)**Given:**A sorted array arr[] of distinct integers**Task:**Sort the array into a wave-like array and return it � arrange the elements into a sequence such that a1 >= a2 <= a3 >= a4 <= a5 ...**Given:**An array A[] of N positive integers**Task:**Write a code to find the maximum of j - i, subject to the constraint A[i] <= A[j]**Given:**An array nums[] of size N**Task:**Construct a Product Array P (of same size N) such that P[i] is equal to the product of all the elements of nums except nums[i]**Given:**An array of size N and a range [a, b]**Task:**Partition the array around the range such that the array is divided into three parts: All elements smaller than**a**come first; all elements in range**a to b**come next; all elements greater than**b**appear in the end**Given:**An array A of size N (the elements of the array are distinct and are sorted)**Task:**Find all pairs in the array that add-up to a number K**Given:**An array arr[] of N non-negative integers representing the height of blocks**Task:**If the width of each block is 1, write a code to calculate how much water can be trapped between the blocks during the rainy season**Given:**An array of integers**Task:**Find the inversion count in the array (the inversion count determines how far away the array is from being sorted)**Given:**An array arr[] of N integers**Task:**Calculate the median

**Amazon Interview Questions on Strings**

Strings are a popular data type used to represent text characters. Below are questions you can expect on strings during an Amazon tech interview:

**Given:**String**S****Task:**Check if it is palindrome or not**Given:**Two strings**a**and**b**consisting of lowercase characters**Task:**Write a code to check whether the two strings are anagrams of each other**Given:**String**S**Check if characters of the given string can be rearranged to form a palindrome

Task:**Given:**String str**Task:**Convert the first letter of each word in the string to uppercase**Given:**String**str**containing only lower case alphabets**Task:**Sort it in lexicographically-descending order**Given:**Two strings**S1**and**S2****Task:**Write a program to merge them alternatively � the first character of S1 with the first character of S2, and so on � till the strings end**Given:**String**S**containing alphanumeric characters**Task:**Find out whether the string is a palindrome or not**Given:**String S**Task:**Reverse the string without reversing its individual words**Task:**Write a code to implement the function**strstr**. The function essentially takes two strings as arguments**(s,x)**and locates the occurrence of the string**X**in the string**S****Given:**Two strings A and B**Task:**Find if A is a subsequence of B**Given:**Two strings s1 and s2**Task:**Write a code to check if s2 is a rotated version of the string s1**Given:**Two strings of lowercase alphabets and a value**K**Write a program function that tells if the two strings are

Task:**K-anagrams**of each other**Given:**Two strings A and B**Task:**Find the characters that are not common in the two strings**Given:**A string**S**consisting of**lowercase**Latin letters**Task:**Find the first non-repeating character in S**Given:**A string**S**Find the length of the longest substring with all distinct characters

Task:**Given:**A string,**Task:**Find the longest substring that is a palindrome, in linear time O(N).**Given:**A decimal number**m****Task:**Convert it into a binary string and apply**n**iterations. In each iteration,**0**becomes**01**, and**1**becomes**10**. Find the**k**th (1-indexing) character in the string after**n**th iteration**Given:**Two binary strings**A**and**B**consisting of only 0s and 1s**Task:**Find the resultant string after adding the two strings**Given:**Two numbers as strings s1 and s2**Task:**Calculate their product**Given:**Two binary strings A and BFind the product of two strings in decimal value

Task:

**Amazon Interview Questions on Sorting**

Sorting is a crucial topic for technical interviews. Below are some Amazon interview questions on sorting algorithms.

**Given:**An array**arr[]**of size**N**Check if it is sorted in non-decreasing order

Task:**Given:**A binary array**A[]**of size**N**Arrange the array in increasing order

Task:**Given:**An array of size N containing only 0s, 1s, and 2s**Task:**Sort the array in ascending order**Given:**an integer**N**and a list**arr**Sort the array using bubble sort algorithm

Task:**Given:**An unsorted array of size N**Task:**Use selection sort to sort arr[] in increasing order**Given:**An array arr[], its starting position �low,� and its ending position �high�**Task:**Implement the partition() and quickSort() functions to sort the array**Given:**An array arr[], its starting position l, and its ending position r**Task:**Sort the array using the merge sort algorithm**Given:**Two integer arrays A1[ ] and A2[ ] of size N and M respectively**Task:**Sort the first array A1[ ] such that all the relative positions of the elements are the same as the elements in the second array A2[ ]**Given:**An integer array of which both first half and second half are sorted**Task:**Write a code to merge the two sorted halves of the array into a single sorted array**Given:**An array arr of size n and an integer X**Task:**Find if there's a triplet in the array which adds up to an integer X**Given:**An array of n distinct elements**Task:**Find the minimum number of swaps required to sort the array in increasing order**Given:**An array**A**of integers**Task:**Find three numbers such that the sum of two elements equals the third element � return the triplet in a container**result**

**Amazon Interview Questions on Hashing**

Amazon asks problems that employ hashing quite regularly in coding interviews. Here are some practice questions on hashing.

**Given:**An**N**x**N**matrix**M**Write a program to find the count of all the distinct elements common to all rows of the matrix

Task:**Given:**Two arrays a1[0..n-1] of size n and a2[0..m-1] of size m**Task:**Write a code to check whether a2[] is a subset of a1[] or not**Given:**A set of**N**nuts of different sizes and**N**bolts of different sizes � there is a one-one mapping between nuts and bolts**Task:**Write a code to match the nuts and bolts**Given:**An array A[] of N positive integers, which can contain integers from 1 to P, where elements can be repeated or can be absent from the array**Task:**Write a code to count the frequency of all elements from 1 to N**Given:**Two arrays A and B of equal size N**Task:**Find if the given arrays are equal or not**Given:**An array of**N**integers**Task:**Find the first element that occurs**K**number of times**Given:**Two arrays**A**and**B**containing integers of size**N**and**M**Write a program to find numbers that are present in the first array, but not present in the second array

Task:**Given:**An array**arr**of**N**integers**Task:**Find the first non-repeating element**Given:**An array of strings**Task:**Write a code to return all groups of strings that are anagrams**Given:**An array N with positive numbers**Task:**Write a code to find the largest subsequence from an array that contains elements that are Fibonacci numbers**Given:**An array of**N**integers, and an integer**K****Task:**Find the number of pairs of elements in the array whose sum is equal to**K****Given:**An integer array and a non-negative integer k**Task:**Count all distinct pairs with the difference equal to k � A[ i ] - A[ j ] = k

**Amazon Interview Questions on Recursion**

Recursion is an important concept in technical interviews and can be a tricky area to master. Here are some practice Amazon interview questions on recursion for your upcoming interview.

**Task:**Write a code to print a sequence of numbers starting with N, where A[0] = N,*without using a loop*, in which A[i+1] = A[i] - 5, until A[i] > 0. After that A[i+1] = A[i] + 5. Repeat it until A[i] = N**Given:**A round table of n persons**Task:**Write a code to find out in how many ways they can shake hands such that no two handshakes cross each other**Given:**n number of people in a circle and a number k, such that k-1 persons are skipped, and the kth person is eliminated**Task:**Write a code to figure out the safest place in the circle**Given:**A string s**Task:**Remove all its adjacent duplicate characters recursively**Given:**An image of size n*m, location of a pixel in the screen(sr, cc) and color nColor**Task:**Write a code to replace the color of a given pixel and all adjacent same-colored pixels with a new color �nColor�

**Amazon Interview Questions on Graphs and Greedy Algorithms**

Graphs and Greedy Algorithms are extremely important concepts that you must master if you wish to ace Amazon�s technical interview. Here are some questions on Graphs.

**Given:**Adjacency list of a bidirectional graph**Task:**Write a code to return the adjacency list for each vertex**Given:**A directed graph**Task:**Write a code to perform breadth-first traversal of this graph starting from 0**Given:**A connected undirected graph**Task:**Write a program to perform depth-first traversal of the graph**Given:**A grid of size n*n filled with 0, 1, 2, 3**Task:**Check whether there is a path possible from the source to destination (you can traverse left, right, up, or down)**Given:**A square chessboard, the initial position of the Knight, and the position of a target**Task:**Write a code to find the minimum steps required by the knight to reach the target position**Given:**An adjacency list of a graph**adj**with V number of vertices and having 0-based index**Task:**Write a code to find whether the graph is bipartite or not**Given:**A 2D binary matrix A(0-based index) of dimensions NxM**Task:**Find the minimum number of steps required to reach from (0,0) to (X, Y)**Given:**A directed graph with**Task:**Find the number of strongly connected components in the graph**Given:**A directed graph**Task:**Find if a vertex j is reachable from another vertex i for all vertex pairs (i, j) in the given graph**Given:**A weighted, undirected, and connected graph of V vertices and E edges**Task:**Write a code to find the sum of weights of the edges of the minimum spanning tree**Given:***Weights*and*values*of**N**items**Task:**Put these items in a knapsack of capacity**W**to get the*maximum*total value in the knapsack**Given:**N activities with their start date and finish date in array start[ ] and end[ ]**Task:**Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity in a given day**Given:**Arrival and departure times of all trains that reach a railway station**Task:**Find the minimum number of platforms required for the railway station such that no train is kept waiting**Given:**A set of N jobs, where each job �I� has a deadline and profit associated with it. Each job takes*1*unit of time to complete and only one job can be scheduled at a time. A profit can be earned if the job is completed before the deadline**Task:**Write a code to find the maximum profit earned and maximum number of jobs that can be done

**Mathematical Problems for the Amazon Interview**

Amazon sometimes asks problems around mathematics, where you have to code the solution to a mathematical problem. Below are some practice questions:

**Given:**The first 2 terms A1 and A2 of an arithmetic series**Task:**Find the Nth term of the series**Given:**The first term and common ratio X and R of a GP series**Task:**Find the nth term of the series**Given:**Two non-zero integers N and M**Task:**Find the number closest to N and divisible by M. If there are more than one such number, then output the one having maximum absolute value**Given:**A 3-digit number**Task:**Find whether it is an Armstrong number or not (an Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself � for example, 371 is an Armstrong number, since 33 + 73 + 13 = 371)**Given:**A number N**Task:**Find if the sum of digits of N is a Palindrome number or not**Given:**A positive number X**Task:**Find the largest Jumping Number smaller than or equal to X (a number is called Jumping Number if all adjacent digits in it differ by only 1. All single digit numbers are considered Jumping Numbers. For example: 7, 8987, and 4343456 are Jumping Numbers, but 796 and 89098 are not)**Given:**Binary number B**Task:**Find its decimal equivalent**Given:**Two numbers A and B**Task:**Find Kth digit at the right of AB**Given:**A number N**Task:**Write a code to reverse its digits**Given:**A number N**Task:**Check if a number is perfect or not (a number is said to be perfect if the sum of all its factors excluding the number itself is equal to the number)**Given:**A number N**Task:**Write a code to find the largest prime factor of that number**Given:**Two integers n and r**Task:**Find nCr (the answer may be very large, so calculate the answer modulo 109+7)**Task:**Write a program to calculate nPr � nPr represents n permutation r and the value of nPr is (n!) / (n-r)!**Given:**A positive integer,] N**Task:**Find the factorial of N**Given:**An array of N positive integers**Task:**Find GCD of all the array elements**Given:**N**Task:**Count all �a�(>=1) and �b�(>=0) that satisfy the condition a3 + b3 = N**Given:**Two numbers (n , m)**Task:**Write a code to find n?m (nth root of m)**Given:**A number N**Task:**Calculate the prime numbers up to N using Sieve of Eratosthenes**Given:**A positive integer N**Task:**Find the sum of all prime numbers between 1 and N(inclusive)

**Amazon Systems Design Interview Questions**

Distributed systems design is an important component in the on-site interview. The design round is particularly important for senior developer and managerial positions. Below are some Amazon interview questions pertaining to distributed and large-scale systems.

- Design an in-memory database system
- Design an IP blocking system
- Design a voting system, where people will cast their votes and the votes get added to corresponding candidates
- Design a system to find 100 top-selling products in a given time window
- Design an Amazon online bookstore, where users can view prices and make purchases
- Design a system where an office administrator knows how many people are present on each floor of the building, given that the building has 3 floors
- Design a system to upload images with tags � users would be able to visit and search for images by entering the tags
- Design a notification service that sends notifications to multiple devices
- Design a comprehensive workflow system that responds to pause/continue functions
- Design a scheduler service that can manage huge schedules with minimal latency

For more details on Amazon system design questions and how to answer them, check out the *�**Amazon System Design Interview Questions**�* article.&n