Advanced
Data Structures Algorithms & System Design(HLD+LLD)
by Logicmojo

Top tech companies experts provide live online training

Learn Data Structures, Algorithms & System Design

Online live classes from 4 to 7 months programs

Get job assistance after course completion


ABOUT AMAZON

Logicmojo - Updated Dec 12, 2023

In this article we will show all the Amazon Interview Questions for 2024 Asked for Amazon SDE and SDET roles. Amazon is an American multinational technology company which focuses on e-commerce, cloud computing, digital streaming, and artificial intelligence. It is one of the Big Five companies in the U.S. information technology industry, along with Google (Alphabet), Apple, Meta (Facebook), and Microsoft. The company has been referred to as "one of the most influential economic and cultural forces in the world", as well as the world's most valuable brand.

But what really is the secret sauce to Amazon's humongous success? Well, if you ask this question to any of the employees at Amazon, we are pretty sure that everyone would unanimously say: The Leadership Principles of Amazon


Landing a job at Amazon is a dream for many developers around the globe. Amazon is one of the largest companies in the world, with a workforce of over half a million strong. For you to join them, you'll need to complete their unique interview that combines technical and leadership knowledge.

Today, We'll go through everything you need to crack the Amazon interview, including coding questions and a step-by-step preparation guide.




data science course
Learn More

If you're interviewing at Amazon soon you may have heard about the Amazon interview process. The process varies by job and department, but there are some similarities it's useful to understand. The overall process works like this:

🚀 Recruiter Connect: Best way to get noticed by Amazon recruiters is to maintain a good Linkedin profile and message recruiters. The candidate can also apply on the Amazon job portal but it is suggested that they also get a referral from an Amazon employee.

🚀 Online Assessment: This online assessment is usually a part of the Amazon hiring process for interns and fresher candidates. Sometimes, it is also included for experienced candidates. The assessment has three sections:

    1.Debugging questions: A set of seven debugging questions will be assigned to you with an allotted time of 20 mins. Amazon Interview Questions are available in Java, Python C, and C++.It will be the three coding languages available for you to solve this assignment.

    2.Questions on coding: The second assessment would comprise two Amazon SDE interview questions based on data structure and algorithm. You can use any of these languages: C, C#, C++, Java, Ruby, Swift, JavaScript, and Python.

    3.Questions based on work simulation and logical reasoning: There are two parts to this assessment; In the first part, you would be given various scenarios from the life of a software development engineer, and your responses to it would be analyzed. The second part would contain 24 multiple choice questions based on logical reasoning.

🚀 Interview Rounds: Amazon conducts four interview rounds alongside an initial coding test. The coding test consists of DS/Algo problems. The first round is an HR round where they ask behavioral questions along with Computer Science theory questions to the candidate. The next three rounds focus solely on DS/Algo. Sometimes apart from that they do conduct a Bar Raiser round. A bar raiser is an experienced person added to an interview loop to ensure that it does not go horribly off the rails. Stated more optimistically, a bar raiser is responsible for ensuring that a candidate has a great experience, and Amazon makes a great hiring decision.

🚀 HR Round: This is when they ask computer science theory and behavioural questions to the candidate. The questions may enquire about the candidate's experience at previous companies and conflicts the candidate might have faced with colleagues/managers.


Once the team and you both are comfortable and ready to start, the offer letter is prepared and shared with you by the recruiters and you are HIRED!!

How to Answer Amazon Interview Questions

While you could just jump into the fray, memorize a few Amazon interview questions and be done with it (Another hint: That's as far as most people get) that's not the best way to go about things.

Now, it's important to understand that talking about your skills is only one part of the equation. You also need to be ready for Amazon behavioral interview questions. Some of these can be a little tricky, but, when handled properly, behavioral interview questions are also chances to shine.

In most cases, a two-step approach is best. Begin by embracing the STAR method. With that, you can take a boring old, rusty dagger or a response, carefully polishing and sharpening it into a penetrating answer that captures the attention of the hiring manager. It lets you craft your response into a compelling story, which is a lot more engaging.

What is STAR Method

The STAR interview technique offers a straightforward format you can use to answer behavioral interview questions those prompts that ask you to provide a real-life example of how you handled a certain kind of situation at work in the past.

So, let's break down that framework. STAR is an acronym that stands for:

Situation: let the scene and give the necessary details of your example.

Task: Describe what your responsibility was in that situation.

Action: Explain exactly what steps you took to address it.

Result: Share what outcomes your actions achieved.

The STAR interview process for answering behavioral interview questions might seem a little overwhelming at first. But it will become second nature with a little practice. And make no mistake, practicing is definitely something you should do. "Whether it's in a mock interview or just practicing your answer in the mirror, talk through your response so that it feels natural and comfortable when you're actually in the interview"


What to do when stuck

Getting stuck during coding interviews is extremely common. But do not worry, that is part of the process and is a test of your problem solving abilities. Here are some tips to try out when you are stuck:

  • 🚀 Talk through what you initially thought might work and explain why it doesn't

  • 🚀 Come up with more test cases and write them down

  • 🚀 Think about how you would solve it without a program

  • 🚀 Recall past questions related to the topic, what similar questions in the past have you encountered and what techniques did you use to solve them?

  • 🚀 Enumerate through the common data structures and whether they can be applied to the question. There really aren't that many - stack, queue, dictionary, heap, graph, etc.

  • 🚀 Look out for repeated work and determine if you can cache those computations.

While coding

Write your code with a neat coding style (consistent indentation, spacing around your operators). Reading code written by others is usually not an enjoyable task. Use clear variable names, avoid single letter names unless they are for iteration.

Always be explaining what you are currently writing/typing to the interviewer. This is not about literally reading out what you are typing to the interviewer. Talk about the section of the code you are currently implementing at a higher level, explain why it is written as such and what it is trying to achieve.




Most Common Amazon Interview Questions


Two Sum

Given an array and an integer target, find the indices of the two numbers in the array whose sum is equal to the given target.

View

Kadane's Algorithms

Find the sum of contiguous subarray within a one-dimensional array of numbers
that has the largest sum.

View

Next Greater Permutation

Given an array, rearrange it to its next greater permutation. Do it in-place with extra
constant memory only.

View

Matrix Rotation

Given a matrix, turn it by 90 degrees in clockwise direction without using any extra space.

View

Merge Overlapping Intervals

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping

View

Max Consecutive Ones

Given an array of 1s and 0s,find the
maximum number of consecutive 1s in the array.

View

Pascal's Triangle

Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle..

View

Kth Largest Element

Given an array and a number k where k is smaller than the size of the array, we need to find the k'th largest element in the given array.

View

Search Rotated Sorted Array

Search for a given number in a sorted array, with unique elements, that has been
rotated by some arbitrary number.

View

Trapping Rain Water

Given n non-negative integers representing
an elevation map where the width of each
bar is 1, compute how much water it is able to trap after raining.

View

Intersection of Two Linked Lists

Given the heads of two singly linked-lists
A and B, return the node at which the two lists intersect.

View

Median of Row-wise Sorted Matrix

We are given a row-wise sorted matrix of size r*c, we need to find the median of the matrix given. It is assumed that r*c is always odd.

View

Clone List with Random Pointer

A linked list of length n is given such that
each node contains an additional random pointer, which could point to any node in the list, or null.

View

Merge Two Sorted Linked List

You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. Return the head of the merged linked list.

View

Reverse a Linked List in K-groups

Given a linked list and a positive number k, reverse the nodes in groups of k. All the remaining nodes after multiples of
k should be left as it is.

View

Non-Repeating Element

Given a sorted list of numbers in which all elements appear twice except one element that appears only once, find the number that appears only once.

View

Implement Min Stack

Implement a stack that supports the
following operations in O(1) time complexity

View

Balanced Parentheses

Given an expression string exp, write a
program to examine whether the pairs
and the orders of “{“, “}”, “(“, “)”, “[“, “]” are correct in exp.

View

Next Greater Element

Given an array, print the NGE for every
element. The Next greater Element for an element x is the first greater element on the right side of x in the array.

View

Largest Rectangle in Histogram

Given an array of integers representing
the histogram's bar height where the
width of each bar is 1,return the area of the largest rectangle in the histogram.

View

Longest Subarray with Zero Sum

Given an array of integers, find the length of
the longest sub-array with a sum that
equals 0.

View

Longest Consecutive Subsequence

Given an array of integers, find the length
of the longest sub-sequence such that elements in the subsequence are
consecutive integers.

View

Sliding Window Maximum

Given an array and an integer K, find the maximum for each and every contiguous subarray of size k.

View

Longest Substring Without Repeat

Given a string s, find the length of the
longest substring without repeating
characters.

View

Maximum Path Sum of Binary Tree

Given a binary tree, find the maximum path sum. The path may start and end at any
node in the tree.

View

Lowest Common Ancestor in Binary Tree

The lowest common ancestor of two nodes p and q is the lowest node in the binary tree
that has p and q as its descendants
.Return the reference to the lowest common ancestor of p and q.

View

Bottom View of Binary Tree

The bottom view of a binary tree contains the set of nodes that will be visible if you look at the binary tree from the bottom.

View

Rat In A Maze

You are given a maze of size n * m. Each cell is either clear or blocked denoted by 1 and 0 respectively. A rat sits at the top-left cell and there exists a block of cheese at the bottom-right cell.

View

Combination Sum

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target.

View

Rotting Apples

You are given an n * m grid where each
position can contain one of the three values. Find the minimum number of days required
for all the apples to be rotten

View

Diameter of Binary Tree

Given a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes of the tree. The length is the number of edges in the path.

View

Binary Tree from Preorder and Inorder Traversal

Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.

View

Longest Increasing Subsequence (LIS)

Given an array A, find the length of the longest strictly increasing subsequence (LIS). A subsequence is a sequence that can be derived from an array by deleting some or no elements such that the order of the remaining elements remain the same.

View

Word Search Board

Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from
letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring.

View

Number of Islands

You are given a 2-D matrix surface of size n*m. Each cell of the surface is either 1 (land) or 0 (water). Find the number of islands on the surface. An island is surrounded by water
and is formed by connecting adjacent lands horizontally or vertically.

View

Knight's Journey On A Chessboard

You have a chessboard of size n*n. A knight
sits on the board at a position start(x, y). The knight wants to go to another cell end(x, y). Find the minimum number of moves required to go from the start position to the end position.

View

Coin Change

You are given coins of different denom
inations, represented by an array - coins
of size n. You are also given a value - target. Find the different number of combinations
that make up the amount target.

View

LRU Cache

Implement Least Recently Used (LRU) cache. You need to implement functions like get
, add for the LRUCache class

View

Find xth Node from End of Linked List

Given a linked list, find the xth node from the end of the linked list.

View

Pythagorean Triplet in an array

Given an array of integers, write a function that returns true if there is a triplet (a, b, c) that satisfies a2 + b2 = c2.

View

Add One to Linked List

Given a natural number in the form of a
linked list, add 1 to it.

View

Check if BST is valid or not

Given the root of a binary tree, determine if
it is a valid binary search tree (BST).

View

logicmojoContact

HAVE A QUESTION? GIVE US A CALL OR CONTACT US - WE'D LOVE TO HEAR FROM YOU

PHONE: +91 80889-75867

WhatsApp : Click Here...

FEEDBACKFORM