Amazon | SDE 1(New grad) | India [Offer]
Anonymous User
1793

There was an online assessment prior to the virtual onsite interviews. I don't remember the questions though.

Round 1

Question 1

Given a stream of numbers, find the number of groups that can be formed using the maximum number of elements such that each group satisfies the following constraints -
Group constraints
Each group can have only 2 or 3 elements
The sum of elements in the group should be divisible by 3
Ex: 1,2,3,5,7,12,14,18,24
Ans: 3
[(1,2,3),(5,7,12),(18,24)]
PS: You can skip elements also

Question 2
Given a 2D matrix consisting of only 0s and 1s where each row and column is sorted in the non-increasing order, give an optimal solution to count the number of 0s.
Ex:
1 1 1 0
1 1 0 0
1 0 0 0
0 0 0 0
Ans: 10

Round 2

Question 1
Given a family of ants and the interactions between them, classify the family as good or bad. A family is good if every ant interacts with ants of opposite gender only.
3 ants, 3 interactions
1 2
2 3
13
Ans: Bad

Question 2
Given an algorithm to find min element in O(1) using stacks - https://www.***.org/design-a-stack-that-supports-getmin-in-o1-time-and-o1-extra-space/

Question 3
Given an array, find the next greater element for each - similar to https://leetcode.com/problems/next-greater-element-ii/
Ex: 1 3 2 4
Ans: 3 4 4 -1

Round 3
Asked about projects mentioned in my resume

Question 1
Find number of connected components in matrix - https://leetcode.com/problems/number-of-islands/

Question 2
Check if tree has mirror image structure - similar to https://leetcode.com/problems/symmetric-tree/

Question 3
Give an efficient way to retrieve the top 5 selling products in Amazon (used heaps)

Theory questions asked
Diff between threads and processes
Indexing in dbms
Deadlocks
Types of scheduling
What is primary key and secondary key in dbms?
Topological sorting

Round 4

Question 1
Kth largest element in BST - similar to https://leetcode.com/problems/kth-smallest-element-in-a-bst/ (just do reverse inorder)

Question 2
LRU cache - https://leetcode.com/problems/lru-cache/

In depth discussion about internship and project works
HR question: Describe a situation when you felt completely stuck. What did you do to overcome?

I would like to thank the entire leetcode community and the discussion forums in particular which have been very insightful. I hope to continue practicing and learning more :)

Comments (4)