i
Amazon
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
Find sum of all numbers formed from root to leaf path in a binary tree
Traverse the binary tree using DFS
At each leaf node, add the number formed from root to leaf path to a sum variable
Return the sum variable
Time complexity: O(n)
Example: For a binary tree with root value 1, left child 2 and right child 3, the sum would be 12 + 13 = 25
Given a string, print all possible strings that can be made by placing spaces (zero or one) in between them.
Use recursion to generate all possible combinations of spaces
For each recursive call, either add a space or don't add a space between the current character and the next character
Base case is when there are no more characters left to add spaces between
Time complexity is O(2^n) where n is the length of the string
Preorder traversal without recursion
Use a stack to keep track of nodes
Push right child first and then left child onto stack
Pop top of stack and print value
Repeat until stack is empty
Find longest continuous patch on a 12 km road with updates in patches
Maintain a variable to keep track of current patch length
Update the variable whenever a new patch is added
Maintain a variable to keep track of longest patch so far
Compare current patch length with longest patch length and update if necessary
Use a sorted data structure like a binary search tree to store the patches for efficient search
Time complexity: ...
Find median of an unsorted array.
Sort the array and find the middle element
Use quickselect algorithm to find the median in O(n) time
If the array is small, use brute force to find the median
Find 'k' elements closest to a given number from a stream of characters.
Use a priority queue to keep track of closest elements.
Update the queue as new characters come in.
Return the 'k' closest elements from the queue.
Design a data structure with O(1) insert, remove, find-max, and delete-max operations.
Use a doubly linked list to maintain the elements in sorted order.
Use a hash table to store the pointers to the nodes in the linked list.
Maintain a pointer to the maximum element in the hash table.
Update the pointers in the hash table when inserting or removing elements.
Update the maximum pointer when deleting or inserting the maximum
Check if a given linked list is a palindrome.
Traverse the linked list and store the values in an array.
Compare the first and last elements of the array, then move towards the center.
If all elements match, the linked list is a palindrome.
Alternatively, use two pointers to find the middle of the linked list and reverse the second half.
Compare the first half with the reversed second half to check for a palindrome.
Hacker Rank test - 4 rounds (Coding, System Design and Work style assessment, Leadership Principles)
I applied via Company Website and was interviewed in Mar 2024. There were 2 interview rounds.
Amazon Online assessment which consisted of 2 coding DSA medium question
What people are saying about Amazon
Diameter of a binary tree and bfs and dfs questions
Data structure and algorithms
Amazon interview questions for designations
Get interview-ready with Top Amazon Interview Questions
I was interviewed in Apr 2021.
Round duration - 60 Minutes
Round difficulty - Medium
Timing: 10AM-11AM
Interviewer was quite supportive and helpful.
Environment was normal as usual and it was morning time
Design a system where user can upload, delete and share the video/image files.
And can immediately view the uploaded files on the different logged-in system
Round duration - 60 Minutes
Round difficulty - Medium
Timing: 11AM-12PM
The interviewer was SDE2
He was checking the code for edge cases and was hinting if required
Approach:
A brute force solution to this problem is to turn on and off the bulbs N time, then at last check the number of bulbs that are on.
Algorithm:
Round duration - 60 Minutes
Round difficulty - Medium
Timing: 6PM-7PM
The interviewer was not interactive and didn't gave any feedback whatsoever.
It was Hiring Manager Round
Interviewer was Software Development Manager at Amazon
In this problem, our primary focus is on the common elements i.e. an element that is present in both the arrays. Then, we have to decide whether we have to make a switch. So for that, first we store all the elements of ‘ARR1’ and ‘ARR2’ into ‘MAP1’ and ‘MAP2’ respectively.
Now we call our ‘maximiseSumHelper’ function. We call this function for both cases i.e starting with ‘ARR1’ and starting with ‘A...
Tip 1 : Focus on internals of Data structure on how it actually works
Tip 2 : Implement the Data Structure from scratch, later you can use the inbuilt packages no problem but you must know the implementation
Tip 3 : Understand System Design concepts
Tip 1 : Highlight your contributions you made and how it impacted the business and be real
Tip 2 : Mention the improvement figures like x% reduction in page load size, improved SEO ranking by x figure, reduce memory usage by y%
I was interviewed in Apr 2021.
Round duration - 60 minutes
Round difficulty - Easy
Started with brief intro(5 mins) about interviewer.
Problem solving question, question was already there in the codelink shared by the interviewer. He explained the problem again with sample testcase.
The Interviewer was friendly.
Our current algorithm is based on the idea of the BFS approach. We first process all the courses with 0 in-degree implying no prerequisite courses required. If we remove all these courses from the graph, along with their outgoing edges, we can find out the courses/nodes that should be processed next. These would again be the nodes with 0 in-degree. We can continuously do this until all the courses h...
System design a live video broadcast platform.
Round duration - 90 minutes
Round difficulty - Medium
There were 2 interviewers(India HM and Seattle HM), India HM was just shadowing and didn't ask any questions. Started with intro, he asked in detail about what I do at current company(10 mins). Again, jumped into LP's(25 mins).
In any rooted tree, the distance between two nodes 'U' and 'V' can be found by finding the lowest common ancestor (LCA), ‘x’ of two nodes. The lowest common ancestor (LCA) between nodes 'U' and 'V' is defined as the lowest node in the tree that has both 'U' and 'V' as descendants, where we define each node to be a descendant of itself (so if 'U' has a direct connection from 'V', 'V' is the lowest common a...
Store the incoming data elements in a vector. Sort the vector everytime you need to output the median.
Algorithm:
Round duration - 60 minutes
Round difficulty - Medium
There was only 1 interviewer in this round and We had no video sharing in this round so it was becoming difficult to understand each other.
Started with brief intro about both(5 mins), then he jumped into LP's(25 mins). This was very difficult since there was no video and he was grilling me real hard on this, so...
Tip 1 : Bookmark the GFG Amazon Archives. It helped me a lot during my preparations. Reading other’s interview experiences is one of the best ways to get yourselves ready for the next job interview. Practice daily atleast 5 questions.
Tip 2 : Most commonly asked topics in Amazon Interviews ( as per the mail I received from my recruiter ) :
BFS/DFS/Flood fill, Binary Search, Tree traversals, Hash tables, Linked list, stacks, queues, two pointers/sliding window
Binary heaps, Ad hoc/string manipulations.
Tip 3 : Highly recommended sites for practicing questions ( usually practice medium and hard level questions) :
Leetcode (highly encouraged)
Geeksforgeeks (highly encouraged)
CodeZen( highly encouraged)
Codeforces
Tip 4 : This is a great bigocheatsheet that could be of great help https://www.bigocheatsheet.com/
Tip 1 : Mention past working experience in detail as how you were important to your previous company.
Tip 2 : Try to keep your resume to 1 page if work experience < 5 years
Tip 3 : Update your resume according to role you are applying for and never put false things on resume.
I was interviewed in Mar 2021.
Round duration - 45 minutes
Round difficulty - Medium
This round was scheduled in the evening hours and all the participants were required to fill a form which was shared 15 minutes prior to the start of the online coding round. This form was filled out probably for the security reasons and to ensure that no one disinterested participant gives the test.
The approach is based on the fact that the value of each node in a BST is greater than the value of all the nodes in the left subtree and smaller than the value of all the nodes in the right subtree.
Here is the complete algorithm-
Round duration - 60 minutes
Round difficulty - Hard
This round was on call where I was just supposed to answer the tech questions that were asked. It started with a brief interview with one another and then moved to questions on DBMS, operating systems, computer networks and all. Almost 20-25 questions were asked and I probably answered 90% of them correctly.
The first line of input contains a single integ...
One way is to use recursion to reverse the list. Divide the linked list in two halves, the first node and the rest of the list. Reverse the second half using recursion and append the first half, that is the first node at the end of the reversed linked list. Return the head of the reversed linked list.
Algorithm
Round duration - 30 minutes
Round difficulty - Hard
There was only one interviewer for this round. He continuously interacted with me and was giving me some good situational problems that were not very easy to answer. Basically those were open-minded questions which can be answered oth ways and that's why I found it quiet hard as per my nature but at the end things went well for me.
A noticeable aspect in this puzzles is the fact that there’s a circular misplacement, which implies if apple is wrongly labelled as Apple, Apple can’t be labelled as Orange, i.e., it has to be...
Note: basically it's better if you have seen some puzzles before any HR round since they will give you an idea of what kind of problem you may encounter and then you can ace any difficult to difficult HR interview.
Tip 1 : practice on gfg and coding ninjas
Tip 2 : compete on codechef and codeforces
Tip 3 : learn DSA and practice regularly
Tip 1 : put your entire valuable experience in brief
Tip 2 : put the handle of you competitive coding profiles
Tip 3 : try to put those things that really attracts the recruiter, will be better if your past experiences relates to the company
I was interviewed in Oct 2020.
Round duration - 90 minutes
Round difficulty - Easy
I got a call from an Amazon recruiter regarding the schedule of the test . She sent me the coding test link which I had to complete within a week. we can attempt the online test anytime, when we have time for a period of 90 minutes at a stretch.Once I completed the test, I got a call to schedule the interviews in two weeks.
We can check all possible combinations to buy items. That can be done by maintaining a variable “answer” and iterating over all four lists in a nested way such that each pant, shirt, shoe, and skirt pair can get selected and find the sum of that pair. If sum is less than or equal to budget then increment “answer” by one. Return the “answer”.
Algorithm:
The brute force approach is we check for every possible submatrix in the given ‘MAT’.
Here is the algorithm :
Round duration - 60 minutes
Round difficulty - Medium
Virtual interview occured in amazon chime.The interviewer gave his introduction, asked me a bit on the kind of projects I’ve worked on. Then he started with a data structure problem.
The idea is to use a HashMap to map the tree nodes to each clone node. We will traverse the binary tree and create a clone tree with the random pointer equal to NULL and map each node of the given tree to its clone node. Now we will again iterate through the tree and add the random pointer of each node by looking up the HashMap.
The steps are as follows:
We can initially create a graph with 2 nodes from each colony i.e. the first and last house of each colony would be included in the graph. We also create an edge from the node representing the last node of each colony to the node representing the first node of the next colony, and vice versa.
Now, we add into the graph each house that has an outgoing or incoming secret path. We also make edges ...
Round duration - 75 Minutes
Round difficulty - Easy
This was taken by an engineering manager who asked me regarding my projects for around 10-15 mins and then we moved to a system design problem. He asked me to design Slack messenger.
I started by listing the functional and non-functional requirements(on which he questioned me a bit), then I moved to draw the high-level architecture. The components which I drew were the clients, gateway service(LB + authentication, etc), Messaging Service, User Service, Web Socket Manager service, Fan Out service(I added this for the group messages thing, but he didn’t interrogate much on that).
He asked me what would be the schema of my messages table and the scenarios in which the recipient user is online/offline.Also asked about the partitioning key and primary key of the 2-3 tables which I had made
This was taken by an SDE III guy, who again asked me about my projects for like 10 mins and then moved on to a low level design question.He asked me to design the HackerRank platform.
Aga...
Round duration - 60 minutes
Round difficulty - Hard
BarRaiser Round
This was again taken by an engineering manager who discussed my projects in depth for around 20-25 mins. In the remaining time he asked me 2 dsa questions. (Yes I too was surprised that he didn’t ask anything regarding design).
In almost all the rounds, I was asked questions related to Amazon Leadership principles, so do make sure you go through those before sitting for the interview process. You can refer to this link(https://www.codingninjas.com/codestudio/problem-lists/top-amazon-coding-interview-questions) for practicing the same, I found it useful.
In the design rounds, interviewer doesn’t expect the most ideal answer from you and unless your choice of technology is outrageously wrong, he won’t pinpoint that.
The idea behind this approach is that two or more than two strings are anagrams if and only if their sorted strings are equal. So we will use a HashMap, let’s say “anagramGroup”, where each key is a sorted string, and the key will be mapping to the list of indices from the given list of strings that form a group of anagrams. This means that if we sort the strings at those indices, we will get the ...
One way is to recursively add the two linked lists. Keep the nodes in the recursion stack and add the last nodes first and then second last and so on. Initially, find the size of both the linked lists. If both the linked lists are of the same size, add them using recursion. Else if their sizes differ, move the head pointer of the larger linked list forward K times, where K is the difference between th...
Tip 1 : Expect questions related to Amazon Leadership principles in all rounds, so go through those thoroughly before sitting for the interview process.
Tip 2 : In the design rounds, interviewer doesn’t expect the most ideal answer from you and unless your choice of technology is outrageously wrong, he won’t pinpoint that.
Tip 3 : Data Structures questions are a must in all rounds, so try to master them thoroughly
Tip 1 : Make sure you know everything you mention in your resume
Tip 2 : Have some hands on with hackathons and contests ,which brings an added value to your resume
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
I used DFS to find number of distinct components.
In this approach, we will first iterate through the Linked List and find the length of the given Linked List. Then we will initialize two Linked List ‘HEAD1’ and ‘HEAD2’ to store the two numbers.
We will iterate on the Linked List till half-length and create a new list to store the first half with a head equal to ‘HEAD1’. Similarly, we will keep the second half in a new list with a head equals to ‘HEAD2...
Round duration - 60 minutes
Round difficulty - Medium
O(1).
&nb...
Round duration - 60 Minutes
Round difficulty - Hard
Paraphrasing the solution in my words
Let's take an example. s="catsand" and wordDict = ["cat", "cats", "and", "sand"].
The solution starts by taking the string S( "catsand") initially finding whether whole string is present or not . IN this case it is not present in the dict.
Now breaking the string and then finding
s.substr( i) gives the substring from ith index till the end. so string word goes as
atsand // not present
ts...
The first line contains an Integer &...
Make use of the stack. Traverse the string and push the current character in the stack if it is an opening brace else pop from the stack If it is the corresponding starting brace for current closing brace then move to the next character of the string otherwise return false.
If after complete traversal if the stack is empty then the string is balanced else it is not balanced.
Pseudo Code:
Round duration - 60 minutes
Round difficulty - Easy
Design a local transport system like BMTC.
Round duration - 60 minutes
Round difficulty - Easy
It was mix of HLD, LLD design discussion of your project. Make sure you know enough about your projects. Questions asked were based on Amazon leadership principles. Amazon mainly focuses o...
Tip 1: Revolve your answers around amazon leadership principles.
Tip 2: Make sure you do have good knowledge of your projects.
Tip 1 : Practice a lot.
Tip 2 : Focus on system design
Tip 3 : Focus on amazon Leadership principles.
Tip 1: Mention relevant details for job you are applying.
Tip 2: Be objective and concise.
based on 18 reviews
Rating in categories
Customer Service Associate
4.1k
salaries
| ₹0.6 L/yr - ₹6 L/yr |
Transaction Risk Investigator
3.1k
salaries
| ₹2.5 L/yr - ₹6.5 L/yr |
Associate
2.8k
salaries
| ₹0.8 L/yr - ₹6.7 L/yr |
Senior Associate
2.4k
salaries
| ₹2 L/yr - ₹10.1 L/yr |
Program Manager
2k
salaries
| ₹9 L/yr - ₹36 L/yr |
Flipkart
TCS
Netflix