i
Amazon
Filter interviews by
Clear (1)
I applied via Recruitment Consulltant and was interviewed before Apr 2021. There were 2 interview rounds.
2 coding questions
I was interviewed before May 2021.
Round duration - 45 Minutes
Round difficulty - Easy
Given an integer N
representing the number of pairs of parentheses, find all the possible combinations of balanced parentheses using the given number of pairs.
Generate all possible combinations of balanced parentheses for a given number of pairs.
Use recursion to generate all possible combinations of balanced parentheses.
Keep track of the number of open and close parentheses used in each combination.
Terminate recursion when the number of open and close parentheses used equals the given number of pairs.
Round duration - 45 Minutes
Round difficulty - Easy
You are given a binary tree of integers. Your task is to print the boundary nodes of this binary tree in an anti-clockwise direction starting from the ro...
Print the boundary nodes of a binary tree in an anti-clockwise direction starting from the root node.
Traverse the left boundary nodes from top to bottom
Traverse the leaf nodes from left to right
Traverse the right boundary nodes from bottom to top
Handle cases where nodes are null (-1)
Print the boundary nodes in the specified order
Round duration - 45 Minutes
Round difficulty - Easy
Given a binary tree, the task is to print its bottom view from left to right. Assume the left and the right child nodes make a 45-degree angle with their paren...
The task is to print the bottom view of a binary tree from left to right.
Traverse the binary tree in level order and keep track of the horizontal distance of each node from the root.
For each horizontal distance, update the node value in a map to get the bottom view nodes.
Print the values of the map in sorted order of horizontal distance to get the bottom view sequence.
Round duration - 45 minutes
Round difficulty - Easy
Bar raiser
Yes, I can design a parking lot using LLD and a tiny URL service using HLD.
For designing a parking lot using LLD, we can create classes like ParkingLot, ParkingSpot, Vehicle, etc. with their respective attributes and methods.
For designing a tiny URL service using HLD, we can focus on scalability, fault tolerance, and performance. We can use techniques like sharding, caching, load balancing, etc.
In the parking lot LLD, ...
Tip 1 : Prepare 1-2 examples for each Leadership Principles
Tip 2 : Prepare questions from the latest interview experiences
Tip 1 : Concise, without errors
Tip 2 : Highlight years of experience
What people are saying about Amazon
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.
Amazon interview questions for designations
Some of the top questions asked at the Amazon SDE-2 interview -
based on 3 interviews
3 Interview rounds
based on 18 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.9k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Associate
2.3k
salaries
| ₹0 L/yr - ₹0 L/yr |
Program Manager
2.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Flipkart
TCS
Netflix