i
Amazon
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
I was interviewed before Sep 2020.
Round duration - 45 minutes
Round difficulty - Medium
The first Round was held on Hackerrank and the questions were of medium difficulty based on Data Structures and Algorithms.
The time of test was 1:00 PM and it was of 45 minutes with 2 coding questions to be solved.
Given a specified number of intervals, where each interval is represented by two integers denoting its boundaries, the task is to merge all overlapping interv...
Merge overlapping intervals and return sorted list of merged intervals.
Identify overlapping intervals based on start and end times
Merge overlapping intervals to form new intervals
Sort the merged intervals in ascending order of start times
Consider 'N' individuals standing in a circle, numbered consecutively from 1 to N, in a clockwise direction. Initially, the person at position 1 starts counting and will skip K-...
The Josephus problem involves eliminating individuals in a circle until only one remains, based on a specific counting rule.
Start counting from position 1, skip K-1 individuals, eliminate the Kth person, and continue until only one person remains.
The position of the last surviving person can be determined based on the initial numbering and the value of K.
Example: For N=5 and K=2, the last person standing is at position
Round duration - 75 minutes
Round difficulty - Medium
A google Doc was shared with us and we were supposed to write code there.
Use of IDEs was not allowed so we had to write correct code on Google Docs which was later checked by them through online IDEs.
The Interviewer were friendly and observative and helped us through code if we made some silly error.
You are given an array/list HEIGHTS
of length N
, where each element represents the height of a histogram bar. The width of each bar is considered to be 1.
Compute the area of the largest rectangle that can be formed within the bounds of a given histogram.
Iterate through the histogram bars and maintain a stack to keep track of increasing heights.
Calculate the area of the rectangle formed by each bar as the smallest height in the stack times the width.
Update the maximum area found so far.
Time complexity can be optimized to O(N) using a stack-based approach.
Given a binary tree of integers, your task is to return the boundary nodes of the tree in Anti-Clockwise direction starting from the root node.
The first line ...
Return the boundary nodes of a binary tree in Anti-Clockwise direction starting from the root node.
Traverse the left boundary nodes in top-down order
Traverse the leaf nodes in left-right order
Traverse the right boundary nodes in bottom-up order
Handle duplicates in boundary nodes by including them only once
Round duration - 60 minutes
Round difficulty - Medium
The face to face round was held on Google Meet where initially Interviewer asked a DS/Algo problem and then Later Manager Joined and asked about our resume projects in detail.
The time was 10:00 AM
Given an M x N matrix of integers ARR
, your task is to identify the rectangle within the matrix that has the greatest sum of its elements.
The first line of input co...
Find the rectangle within a matrix with the greatest sum of elements.
Iterate through all possible rectangles within the matrix and calculate their sums
Use Kadane's algorithm to find the maximum sum subarray for each row combination
Keep track of the maximum sum found so far
You are provided with a sorted array that has undergone 'K' rotations (the exact value of 'K' is unknown). A rotation involves shifting each element of the array to the right,...
Find the minimum number in a rotated sorted array efficiently.
Use binary search to find the minimum element in the rotated array.
Compare mid element with the last element to determine which half to search.
Adjust the search space based on the comparison to find the minimum element efficiently.
Tip 1 : Prepare OS,DBMS,OOPs too
Tip 2 : Mention atleast one project or past work experience in your resume
Tip 3 : Try maintaining 8+ CGPA as sometimes shortlist is done based on CGPA
Tip 4 : Try past interview questions from Leetcode,Interviewbit.
Tip 1 : Try to Keep Resume 1 Pager
Tip 2 : Have atleast one project or past work experience mentioned
Tip 3 : Don't put false things on Resume as questions are asked in detail from Resume
I was interviewed before Sep 2020.
Round duration - 120 minutes
Round difficulty - Medium
Debugging: This section contained 7 debugging problems, which were having code snippets that have logical error that needs to be analysed and recified.
Reasoning Ability: This section was aving medium level verbal reasoning questions and few aptitude questions.
Coding: This section was having 2 coding problems to be resolved.
You are given an N * N matrix of integers where each row and each column is sorted in increasing order. Your task is to find the positi...
Given a sorted N*N matrix, find the position of a target integer X within the matrix.
Iterate over each row and column to search for the target integer X.
Utilize the sorted nature of the matrix to optimize the search process.
Return the position of X if found, else return -1 -1.
Handle multiple test cases efficiently.
Given a singly linked list and two integers 'N' and 'M', traverse the linked list to retain 'M' nodes and then delete the next 'N' nodes. Continue this proces...
Implement a function to delete N nodes after M nodes in a linked list.
Traverse the linked list while retaining M nodes and deleting N nodes after each M nodes.
Use two pointers to keep track of the nodes to be retained and deleted.
Update the next pointers accordingly to skip the nodes to be deleted.
Repeat the process until the end of the linked list is reached.
Round duration - 55 minutes
Round difficulty - Medium
The interviewer was very friendly and started asking me questions by making me comfortable.
Given a two-dimensional integer array/list 'ARR' of size (N x M), your aim is to print the elements of 'ARR' in a sine wave order. This means that you should print ele...
Print elements of a 2D array in a sine wave order.
Traverse the array in a zigzag pattern, alternating between top to bottom and bottom to top for each column.
Use two pointers to keep track of the current row and column while printing the elements.
Handle edge cases such as empty arrays or arrays with only one row or column.
Example: For input [[1, 2], [3, 4]], the output should be [1, 3, 2, 4].
Given an array ARR
consisting of non-negative integers, rearrange the numbers to form the largest possible number. The digits within each number cannot be changed.
Rearrange array elements to form the largest number possible by concatenating them.
Sort the array elements in a custom way where the concatenation of two numbers results in a larger number.
Use a custom comparator function to sort the array elements.
Convert the sorted array elements to a single string to get the largest possible number.
ACID properties ensure database transactions are processed reliably and consistently.
Atomicity: All operations in a transaction are completed successfully or none at all.
Consistency: Database remains in a consistent state before and after the transaction.
Isolation: Transactions are isolated from each other until they are completed.
Durability: Once a transaction is committed, changes are permanent and survive system fai...
Tip 1 : Here I would like to advise practicing many questions on data structures, DBMS and algorithms as you can because it is the question practice that would help you in building your concepts strong. I practiced a lot of questions on Interview from all modules of data structures and algorithms because there you can find the recent interview questions that you should know. It is the main crux of any interview
Tip 2 : Go through Leetcode in details as it has a good variety of questions sorted on topic wise difficulty level where you can try to solve at least 40 questions for each data structure, DBMS and algorithm. Regularly participate in the contests happening normally on weekly basis there so that you could know about your weak areas to improve. This will boost your confidence.
Tip 3 : Also clear about some basic concepts of Operating systems and Databases along with coding , that would help in your interviews. One more thing is that do some good research about the company's goal and vision and be prepared to ask some company-related knowldege and queries that show your interest in the company. This shows your interest about the company
Tip 1 : Your Resume should consist of as many as good skills, projects, and achievements and award won, if any. Projects would play a crucial part in your interview and you should have at least one most relevant and good project that shows how strong your concepts are in development. The good project gives you an added advantage.
Tip 2 : Never fake on your resume and like If you have worked upon some technology for the project part only and don't know the proper depth you could write basics only in your resume. If an misleading information is provided by you than you are going to caught as you will not be able to explain if any question is asked around that.
I was interviewed before Sep 2020.
Round duration - 75 minutes
Round difficulty - Medium
The round was conducted on Hackerrank and I was at home(around 10am) giving this round in Online mode.
This round consists of two coding questions and the duration was 75 minutes.
During this round camera and microphone of my laptop is active.
Given a string STR
, your task is to determine the total number of palindromic substrings present in the string.
The first line contains an integer 't', repre...
Count the total number of palindromic substrings in a given string.
Iterate through each character in the string and expand around it to find palindromic substrings.
Keep track of the count of palindromic substrings found.
Consider both odd and even length palindromes while expanding around each character.
You are provided with a string 'STR'
that consists of lowercase English letters ranging from 'a' to 'z'. Your task is to determine all non-empty possible subsequen...
Generate all possible subsequences of a given string.
Use recursion to generate all possible subsequences by including or excluding each character in the string.
Maintain the order of characters while generating subsequences.
Handle base cases where the string is empty or has only one character.
Store the generated subsequences in an array of strings.
Round duration - 40 minutes
Round difficulty - Medium
This was an online face to face technical round conducted on Hirepro platform. There is an editor in this platform itself, so we have to submit and run our code and also we have to explain the code and approach to the interviewer.
The interview starts with the introduction, then he asks questions on my project. I have developed my project in Python language (Django Framework)
Use a hash set to store unique emails and remove duplicates from the data.
Iterate through the array of emails
For each email, check if it is already present in the hash set
If not present, add it to the hash set
If present, remove the duplicate entry from the data array
Round duration - 20 minutes
Round difficulty - Medium
This was an online face to face HR round conducted on Hirepro platform.
HR first introduce me about the company and company's goals and then she start asking HR questions to me.
I have strong programming skills in Java and Python, but I struggle with time management and communication.
Strong programming skills in Java and Python
Experience with data structures and algorithms
Struggle with time management and communication
Tip 1 : Practice atleast 30 questions of each topic of DSA
Tip 2 : Do practice OOPS thoroughly for the interview part. For the coding round practice arrays, strings, linked list and trees as much as you can.
Tip 3 : Make a blue print of Operating system note while preparing it and just revise it before your interview and coding round.
Tip 1 : You must include only those things in your resume, in which you will be able to answers almost all questions
Tip 2 : Make atleast two projects and include them in the resume, because many time interviewer put all his time discussing projects only. So if you have a command on your project, then it will be beneficial for you.
What people are saying about Amazon
I was interviewed before Sep 2020.
Round duration - 90 minutes.
Round difficulty - Hard
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This...
The task is to find the length of the longest increasing subsequence in a given array.
Iterate through the array and keep track of the length of the longest increasing subsequence seen so far.
Use dynamic programming to solve the problem efficiently.
The time complexity of the solution should be O(N^2) or better.
Consider edge cases such as an empty array or an array with only one element.
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the...
The task is to count the number of inversions in an array.
Iterate through the array and for each element, compare it with all the elements that come after it.
If the current element is greater than any of the elements that come after it, increment the inversion count.
Return the inversion count as the result.
Round duration - 60 minutes
Round difficulty - Medium
This was held on Amazon Chime and the interview lasted for 1 hour. Firstly the interviewer asked to introduce about myself, later asked regarding the projects I have mentioned in my resume. Then started displaying the coding question. The first question is related to Strings. Given a string, find any of its permutation or anagram is a palindrome or not. The second question is Given an array of integers, find the length of the longest increasing subsequence. After solving both the questions in the optimized approach, the interviewer asked me for the 3rd question because we were still having time. The third question is Given a string with no separator, find the missing number in the string.The interviewer was very friendly.
Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the...
The task is to determine whether two given strings form an anagram pair or not.
Anagrams are words or names that can be formed by rearranging the letters of another word
Check if the two strings have the same characters with the same frequency
Convert the strings to character arrays and sort them
Compare the sorted arrays to check if they are equal
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This...
The task is to find the length of the longest increasing subsequence in a given array.
Iterate through the array and keep track of the longest increasing subsequence length at each index.
Use dynamic programming to store the lengths of increasing subsequences ending at each index.
Return the maximum length from the dynamic programming array.
You were given a sequence of consecutive nonnegative integers but missed one while appending them to create a string S
. Your task is to identify the missing integer...
The task is to find the missing number in a string of consecutive nonnegative integers.
Iterate through the string and check if each substring can form a valid number
If a substring forms a valid number, check if it is consecutive with the previous number
If a substring does not form a valid number or is not consecutive, it is the missing number
Handle edge cases such as multiple missing numbers or all numbers already pres
Round duration - 90 minutes
Round difficulty - Medium
This was held on Amazon Chime and the interview lasted for 1 hour. Firstly the interviewer asked to introduce about myself, later asked regarding the projects I have mentioned in my resume. Then started displaying the coding question. The first question is number of islands in a matrix.
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in t...
The task is to find the number of islands present in a 2-dimensional array filled with ones and zeroes.
Iterate through each cell in the array
If the cell is land (1) and not visited, perform a depth-first search to find all connected land cells
Increment the count of islands for each connected component found
Tip 1 : Prepare Data Structures and Algorithms well. They mostly check our Problem Solving ability to find the solutions for the real world problems.
Tip 2 : Be enough confident, don't be nervous. Maintain atleast 2 projects in your resume.
Tip 3 : Even if you are stuck in the problem, just give a try. The interviewer will help you definitely for sure.
Tip 1 : Have atleast 2 projects with the latest technologies.
Tip 2 : You should be able to answer each and every thing present in your resume. Don't lie in your resume.
Amazon interview questions for designations
I was interviewed before Sep 2020.
Round duration - 90 MINUTES
Round difficulty - Medium
You are located at point ‘A’, the top-left corner of an M x N matrix, and your target is point ‘B’, the bottom-right corner of the same matrix. Your task is to calcula...
The task is to calculate the total number of unique paths from the top-left to bottom-right cell of a matrix by moving only right or down.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the number of unique paths for each cell.
Initialize the first row and first column with 1 as there is only one way to reach them.
For each cell (i, j), the number of unique paths is the sum of paths f...
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This...
Find the length of the longest strictly increasing subsequence in an array of integers.
Use dynamic programming to solve this problem efficiently.
Initialize an array to store the length of the longest increasing subsequence ending at each index.
Iterate through the array and update the length of the longest increasing subsequence for each element.
Return the maximum value in the array as the length of the longest increasi
Round duration - 60 minutes
Round difficulty - Hard
This was held on Amazon Chime and the interview lasted for 1 hour. Firstly the interviewer asked to introduce about myself, later asked regarding the projects I have mentioned in my resume.There were 2 interviewers. Then started displaying the coding question. The first question is related to Matrices. Find a pair with maximum product in array of Integers.The second question is Given an treeWrite a Program to Find the Maximum Depth or Height of a Tree.After solving both the questions in the optimized approach, the interviewer asked me for the 3rd question because we were still having time. The third question is Given a string with no separator, find the missing number in the string.The interviewer was very friendly.
Given an array of integers, determine the contiguous subarray that produces the maximum product of its elements.
A subarray can be derived from th...
Find the contiguous subarray with the maximum product of elements in an array.
Iterate through the array and keep track of the maximum and minimum product ending at each index.
Update the maximum product by taking the maximum of current element, current element * previous maximum, and current element * previous minimum.
Update the minimum product by taking the minimum of current element, current element * previous maximum...
You are provided with the Inorder and Level Order traversals of a Binary Tree composed of integers. Your goal is to determine the height of this Binary Tree without actually construc...
Calculate the height of a Binary Tree using Inorder and Level Order traversals without constructing the tree.
Use the properties of Inorder and Level Order traversals to determine the height of the Binary Tree.
The height of a Binary Tree is the number of edges on the longest path from the root to a leaf node.
Consider edge cases like a single node tree or empty tree while calculating the height.
You have a sequence of consecutive nonnegative integers. By appending all integers end-to-end, you formed a string S
without any separators. During this pro...
Find the missing number in a string of consecutive nonnegative integers.
Iterate through the string to find the missing number by checking the consecutive integers.
If there is more than one missing number, all integers are present, or the string is invalid, return -1.
Handle cases where the missing number is at the beginning or end of the string.
Consider edge cases such as single-digit strings or strings with leading zer
Tip 1 : Regular coding practice on GFG, Leetcode and coding ninjas type platforms( Don't be nervous if you wont get in one try.Try until you get)
Tip 2 : Be enough confident, Do not loose hope,Maintain atleast 2 projects in your resume.
Tip 3 : Even if you are stuck in the problem, just give a try. The interviewer will help you definitely for sure.
Tip 1 : Make Sure that your resume is simple and also try to fit all the information in only one page.
Tip 2 : Have atleast 2 projects with the latest technologies,Github link of projects should be provided
Get interview-ready with Top Amazon Interview Questions
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
The online test consists of around 28 MCQs and 2 programming questions.
Determine if one array is a subset of another given two integer arrays ARR1
and ARR2
of lengths 'N' and 'M' respectively.
Return True if ARR2
is a subset of ARR1
, otherwise...
Check if one array is a subset of another array.
Iterate through elements of ARR2 and check if each element is present in ARR1.
Use a set data structure to efficiently check for element presence.
Return true if all elements of ARR2 are found in ARR1, otherwise return false.
You are provided with an array 'Arr' containing 'N' distinct integers and a positive integer 'K'. Your task is to find the Kth smallest and Kth largest e...
Find the Kth smallest and largest elements in an array.
Sort the array and return the Kth element for smallest and (N-K+1)th element for largest.
Use a priority queue to efficiently find the Kth smallest and largest elements.
Handle edge cases where K is equal to 1 or N.
Round duration - 60 minutes
Round difficulty - Medium
It was scheduled a week in advance. The interviewer was very kind and helpful.
Given a Directed Acyclic Graph (DAG) with a specific number of edges and vertices, your task is to determine the longest path reachable from a given source ver...
Find the longest path in a Directed Acyclic Graph (DAG) from a given source vertex.
Use Topological Sorting to find the longest path in the DAG.
Initialize distances to all vertices as minus infinite except the source vertex which is 0.
Update distances of all adjacent vertices of the current vertex by considering the edge weight.
Repeat the process until all vertices are visited and return the maximum distance found.
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherw...
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access.
When capacity is reached, evict the least recently used item before inserting a new item.
Update the order of keys in the linked list whenever a key is acc
Round duration - 60 minutes
Round difficulty - Medium
The round consisted of 1 coding question and few c++ and oops concepts were asked.
Given a string (STR
) of length N
, you are tasked to create a new string through the following method:
Select the smallest character from the first K
characters of STR
, remov...
Given a string and an integer K, create a new string by selecting the smallest character from the first K characters of the input string and repeating the process until the input string is empty.
Iterate through the input string while there are characters left
For each iteration, select the smallest character from the first K characters
Remove the selected character from the input string and append it to the new string
Rep...
Round duration - 60 minutes
Round difficulty - Medium
I was asked 2 questions in this round along with some core concepts. This was my last round.
Given a singly linked list where nodes contain values in increasing order, your task is to convert it into a Balanced Binary Search Tree (BST) using th...
Convert a sorted linked list into a Balanced Binary Search Tree (BST) using the same data values.
Create a function to convert the linked list to an array for easier manipulation.
Implement a function to build a Balanced BST from the array recursively.
Ensure the height difference of the subtrees is no more than 1 for each node.
Use level order traversal to output the values of the BST nodes.
Handle NULL nodes by representi
You are provided with a stack "ARR" containing "N+1" elements. Your task is to delete the middlemost element so that the resulting stack contains "N" elemen...
Delete the middle element from a stack to reduce its size by one.
Identify the middle element based on whether the stack size is odd or even
Remove the middle element from the stack
Adjust the stack size to N by deleting the middle element
Tip 1 : You should have excellent problem solving skills
Tip 2 : Code a lot.
Tip 3 : You should be thorough with your concepts of Data Structures and Algorithm.
Tip 4 : Know the complexities of the code that you’ve written.
Tip 1 : Mention your important projects in detail
Tip 2 : Keep it precise and concise
I applied via Company Website and was interviewed before Nov 2021. There were 2 interview rounds.
Find the cousin of a node in a binary tree.
Cousins are nodes at the same level but with different parents.
Traverse the tree to find the level and parent of the given node.
Traverse the tree again to find all nodes at the same level with different parents.
Return the cousin node if found, else return null.
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Easy
This was an online technical round on the mettl platform, the test window was open from 22 to 25 May 2020
The test had 28 mcqs and 2 coding questions.
The test was proctored. One needed to have webcam on.
A sample test link was provided before test to get familiar with the mettl platform.
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the...
Count the total number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the conditions for inversion are met.
Use a nested loop to compare each pair of elements efficiently.
Keep a count of the inversions found and return the total count at the end.
Given an array of positive integers, your task is to find the GCD (Greatest Common Divisor) of a pair of elements such that it is the maximum among all possible pair...
Find the pair with the maximum GCD in an array of positive integers.
Iterate through all pairs of elements in the array.
Calculate the GCD of each pair using Euclidean algorithm.
Keep track of the maximum GCD found so far.
Return the maximum GCD value.
Round duration - 60 minutes
Round difficulty - Medium
Time : 12pm to 1pm
Mode of Interview : Amazon Chime Video
LiveCode : To write code, it was not a compiler
The interviewer was quite supportive.
Given an array/list 'ARR' consisting of 'N' integers, your task is to find the majority element in the array. If there is no majority element present, return -1.
Find the majority element in an array, return -1 if no majority element exists.
Iterate through the array and keep track of the count of each element using a hashmap.
Check if any element's count is greater than floor(N/2) to determine the majority element.
Return the majority element or -1 if no majority element exists.
You are provided with an array/list ARR
of length N
containing only 0s and 1s. Your goal is to determine the number of non-empty subarrays where the numbe...
Count the number of subarrays where the number of 0s is equal to the number of 1s in a given array of 0s and 1s.
Iterate through the array and keep track of the count of 0s and 1s encountered so far.
Use a hashmap to store the difference between the counts of 0s and 1s seen at each index.
Increment the count of subarrays whenever the difference between the counts seen before matches the current difference.
Round duration - 60 minutes
Round difficulty - Medium
Time : 11 am to 12am
Mode of Interview : Amazon Chime Video
LiveCode : To write code, it was not a compiler
The interviewer was quite supportive.
Given a singly linked list where nodes contain values in increasing order, your task is to convert it into a Balanced Binary Search Tree (BST) using th...
Convert a sorted linked list into a Balanced Binary Search Tree (BST) using the same data values.
Create a function to convert the linked list to an array for easier manipulation.
Implement a function to build a Balanced BST from the array recursively.
Ensure the height difference of the subtrees is no more than 1 for each node.
Use level order traversal to output the values of the BST nodes.
Handle NULL nodes by representi
Your task is to implement a Stack data structure using a Singly Linked List.
Create a class named Stack
which supports the following operations, each in O(1...
Implement a Stack data structure using a Singly Linked List with operations in O(1) time.
Create a class named Stack with getSize, isEmpty, push, pop, and getTop methods.
Use a Singly Linked List to store the elements of the stack.
Ensure each operation runs in O(1) time complexity.
Handle edge cases like empty stack appropriately.
Test the implementation with sample queries to verify correctness.
Tip 1 : Practice questions from all the topics as much as possible
Tip 2 : Be very much attentive while doing projects in college or anywhere, they are asked in detail if mentioned in resume.
Tip 3 : Be consistent while practicing and do a variety of questions rather than doing more questions of same kind.
Tip 1 : You should know whatever you have mentioned in your resume. Don't brag in your resume ever. Be very precise. It doesn't matter how much you have done, what matters is you are very much confident and clear about what you have done.
Tip 2 : Put your projects and the language you code in for sure in your resume.
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
25 mcqs and 2 coding questions
(It was a part of Amazewow process via Amazewit https://www.amazewit.in/)
Timing- any time between 22-24 may 2020
Webcam was on.
Given an array/list of integers ARR
consisting of N
integers, your task is to determine the length of the longest decreasing subsequence.
A ...
Find the length of the longest decreasing subsequence in an array of integers.
Use dynamic programming to keep track of the longest decreasing subsequence ending at each index.
Initialize an array to store the length of the longest decreasing subsequence ending at each index.
Iterate through the array and update the length of the longest decreasing subsequence for each element.
Return the maximum value in the array as the
Given an array arr
of length N, your task is to compute the Next Greater Element (NGE) for each element in the array. The NGE for an element X
is the first greater e...
The task is to find the Next Greater Element (NGE) for each element in an array.
Iterate through the array from right to left and use a stack to keep track of elements.
For each element, pop elements from the stack until finding a greater element.
Store the next greater element in a result array, if no greater element is found, store -1.
Time complexity can be optimized to O(N) using a stack.
Example: For input array [1, 3,
Round duration - 60 minutes
Round difficulty - Medium
It held at morning 10 AM.
The interviewer was very friendly.
I was asked to solve 2 coding questions and was continuously provided with hints by the interviewer.
Question was on Array and Trees.
Given a Binary Search Tree (BST) of integers, the task is to convert it into a greater sum tree. In this transformation, each node's value is replaced by the sum of value...
Convert a Binary Search Tree into a Greater Sum Tree by replacing each node's value with the sum of values of all nodes greater than the current node.
Traverse the BST in reverse inorder (right, root, left) to visit nodes in descending order.
Keep track of the sum of visited nodes and update each node's value with this sum.
Recursively apply the above steps to all nodes in the BST.
Example: For the given BST, the transform...
Round duration - 45 minutes
Round difficulty - Hard
Morning 8 AM.
The interviewer was very friendly provided with various hints.
It was covering complex coding questions on Tree Data Structures.
You are given a binary tree consisting of 'N' unique nodes and a start node where the burning will commence. The task is to calculate the time in minutes required to completely b...
Calculate the time in minutes required to completely burn a binary tree starting from a given node.
Perform a depth-first search (DFS) to calculate the time taken to burn the entire tree.
Track the time taken for each node to catch fire and propagate the fire to its adjacent nodes.
Return the maximum time taken among all nodes as the total time to burn the entire tree.
Given a binary tree and the values of two nodes, your task is to find the distance between these nodes within the Binary Tree.
Distance is defined as the minim...
Find the distance between two nodes in a binary tree.
Traverse the binary tree to find the paths from the root to each node.
Find the lowest common ancestor of the two nodes.
Calculate the distance by adding the distances from the nodes to the common ancestor.
Tip 1: Code More
Tip 2: Study Data Structures
Tip 3: Be Confident
Tip 1: Mention only what you are confident about
Tip 2: Mention tools & technologies used in the project as well
I was interviewed before Sep 2020.
Round duration - 2 hour 30 mins
Round difficulty - Easy
Debugging: This section had 7 debugging problems, which consist of code snippets that have some logical error that needs to be rectified.
Reasoning Ability: This section consists of some verbal reasoning questions and some aptitude questions.
Coding: This section consists of 2 coding problems.
You are given an N * N matrix of integers where each row and each column is sorted in increasing order. Your task is to find the positi...
Given a sorted N * N matrix, find the position of a target integer X within the matrix.
Iterate over each row and column to search for the target integer X
Utilize the sorted nature of the matrix to optimize the search process
Return the position of X if found, else return -1 -1
Given a linked list where each node has two pointers: one pointing to the next node and another which can point randomly to any node in the list or ...
Cloning a linked list with random pointers by creating new nodes rather than copying references.
Create a deep copy of the linked list by iterating through the original list and creating new nodes with the same values.
Update the random pointers of the new nodes by mapping the original node's random pointer index to the corresponding new node.
Ensure the cloned linked list is an exact copy of the original by validating th...
Round duration - 60 minutes
Round difficulty - Medium
Around 30 candidates were shortlisted from my campus and over 150+ candidates were shortlisted from the university, and I was one of them. Then my first round of interviews was scheduled. I was pretty nervous before the interview.
You are provided with a 2D array having dimensions 'N*M'. Your task is to traverse the elements row-wise and return a single-dimensional array which stores these ...
Traverse a 2D array row-wise and return elements in a wave pattern.
Traverse the 2D array row-wise and store elements alternately in a wave pattern.
For each row, store elements from left to right for odd rows and from right to left for even rows.
Return the final 1D array representing the wave pattern of elements.
Given two lists, one representing the preorder traversal ('PRE') of a strict binary tree and the other ('TYPENL') indicating if each node is a leaf ('L') or non-leaf ('N')....
Construct a strict binary tree from preorder traversal and leaf/non-leaf indicators.
Create a binary tree node class with value and left/right pointers.
Use a stack to keep track of parent nodes while constructing the tree.
Check if the current node is a leaf or non-leaf based on 'TYPENL' list.
Round duration - 60 minutes
Round difficulty - Medium
My interviewer introduced himself in the beginning and asked for my introduction.
You've been provided with a sorted dictionary in an alien language. Your task is to determine the character order of this alien language from this dictionary. The dictio...
Given a sorted dictionary in an alien language, determine the character order of the language.
Iterate through the dictionary to find the order of characters based on their appearance in words.
Create a graph of characters and their relationships based on adjacent words in the dictionary.
Perform a topological sort on the graph to determine the character order.
Return the list of characters in the correct order as the outp
Tip 1 : Practice ds and algo
Tip 2 : Be confident
Tip 3 : Speak out loud and Be clear
Tip 1 : Mention only what you know
Tip 2 : Having Cp ranks is a plus
Some of the top questions asked at the Amazon Software Developer Intern interview -
The duration of Amazon Software Developer Intern interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 40 interviews
3 Interview rounds
based on 91 reviews
Rating in categories
Customer Service Associate
4.2k
salaries
| ₹0 L/yr - ₹0 L/yr |
Transaction Risk Investigator
3.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Associate
2.5k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Associate
2.5k
salaries
| ₹0 L/yr - ₹0 L/yr |
Program Manager
2.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Flipkart
TCS
Netflix