Amazon SDE II Interview Experience
Round 1:
Ques 1: Rearrange a LinkedList –
Before : a->x->b->y->c->z
After : a->b->c->z->y->x
1st intuition – Maintain two list for a->b->c and x->y->z respectively.
Reverse the second list and join it at the end of the first list.
Interviewer : Reversing of LL is not allowed.
2nd intuition – Use of Stack, while traversing the second list which is to be reversed, maintain the elements in a stack and then join them.
Interview : Use of stack is not allowed.
3rd intuition – Manipulate the pointers in one-go!!!
Ques 2: Find Diameter of a Tree
Round 2:
Ques 1: Given an array of numbers and a window size, k. Find the max element in each window while traversing the array.
Ques 2: k-Reverse a LinkedList
Leadership Principle Question
Round 3:
Design a Library Management System.
Extended:
Add the concept of Reservations.
Provide the minimum time to wait for a Student before he can be issued a Book.
e.g 3 Books already issued and new student is 37th in queue for the issue.
Leadership Principle Question
Round 4:
Leadership Principle Question
Ques 1: Design a Plugable Cache, i.e. at any time it may be changed from LRU to MFU or LFU, etc.
LRU – Least Recently Used
MFU – Most Frequently Used
Ques 2: Multiple Matrices
Input : [[a, b, c]
[d, e, f]
[x, y, z]]
# of Rows and Columns can vary.
Output: adx, ady, adz, bdx, …. cfy, cfz
Result : Rejected
Contact Us