You are on page 1of 2

this review therefore is in the context of on campus placement.

There was an online aptitude test followed by technical interviews.


There were four technical interviews .
In the first technical interview I was asked to find the pivot element in a sort
ed and rotated array.
O(n) solution is obvious and I gave him O(log n) solution ( binary search )and I
was asked to code it.After writing the code,I was asked to check my code if it
covers all the edge cases or not. I have tested it and it seemed to work for all
the edge cases but the interviwer pointed out a case where my code fails and th
en I have corrected it.He also asked me to write the code for searching an eleme
nt in the sorted rotated array using binary search.
the second question is given a binary search tree ,replace each node with the su
m of numbers greater than the number in the node.I gave him O(n) solution and he
was satisfied with it.
In the second round ,
I was asked to design an application that sends a message to two friends if they
come within two miles of each other.
I gave him a solution indicating the data structures used to maintain the friend
list and model of the solution .
He pointed out the cons of the solution and I modified the data structure.Then t
here was long discussion where I gave him different solutions and He pointed out
the cons of each solution and asked me to overcome it.Finally I arrived at a so
lution and the interviewer was satisfied with it.
He also asked me a couple of puzzles and I answered them.
I think the third round was the bar raiser
I was asked two questions.
The first question was :
Given n jars each having a colour of some value.the value of the colour is from
0 to 100.
when two jars (with colours say 'a' and 'b')are combined, the colour of the resu
lting solution is (a+b)%100.Also (a *b) amount of gas is released .Find a way to
combine all the jars to form a single jar with minimum amount of gas release.(O
nly adjacent jars can be combined).
The problem is similar to matrix chain multiplication- O(n^3)(Dynammic Programmi
ng)and after I gave him the solution I coded it.
The second question was:
A quadra tree is a tree where each node has atmost 4 child nodes.(similar to a b
inary tree which has atmost 2 child nodes).
A monitor screen (black and white) is represented by a qudra tree in the followi
ng way:
case 1:IF the entire screen is white then the value in the root node is white.
similarly if the entire screen is black then the root stores black.
case 2:If the screen is neigther completely black nor white then the screen is d
ivided into 4 quadrents.
and the node has 4 child nodes each representing one of the quadrants.( the scre
en is recursively divided into subscreens).
Now given two screens represented by two quadra trees, return a quadra tree whic
h represents the overlapping of the two screens.( assume when white and white ov
erlaps results in white,black and white overlap results in black , black and bla
ck overlap results in black).
I was asked to write the code for it.
Round 4:
Q1: Implement a stack which supports pop_min (return minimum element in the stac
k in O(1) ) along with push and pop operations.
I gave him a couple of solutions and I was asked to code them.The he gave me a s
olution (maintain a linked list of minimums in the stack) and asked me to code i
t.
Q2: Given a binary tree with fields- {pointer to left child,poiter to right chil
d,next pointer}.
Initially the next pointers are all NULL.
Now fill all the next pointers in each node with pointer to the node which is im
mediately right to the node in the same level. The next pointer of rightmost nod
e in a level shold be NULL.
It can be done using level order traversal using a queue but the interviewer ask
ed me to do it without using queue or any extra memmory and in O(n) time.
Hint: The logic is to fill the next pointers in the (n+1) th level while trvelli
ng in the n th level.
I was asked to code it.
PERSONAL INTERVIEW (HR)
There was no HR interview although I was asked some questions like -Why do you w
ant to join amazon, future plans ,
tell me about yourself,your habits and interests and about why I didn't do an in
tern ..etc
SUMMARY OF EXPERIENCES
The amazon interview process is very cool.The main thing here is to stay focused
since the whole process is time consuming. The interviewers were very friendly
and they are not bothered about the formalities.So the experience was great.
Interview Question this question is a bit difficult because of the limited time I
was given to code it.
Given a binary tree with fields- {pointer to left child,poiter to right child,ne
xt pointer}.
Initially the next pointers are all NULL.
Now fill all the next pointers in each node with pointer to the node which is im
mediately right to the node in the same level. The next pointer of rightmost nod
e in a level shold be NULL.
It can be done using level order traversal using a queue but the interviewer ask
ed me to do it without using queue or any extra memmory and in O(n) time.
Hint: The logic is to fill the next pointers in the (n+1) th level while trvelli
ng in the n th level.
I was asked to code it

You might also like