Archives

gravatar

Blog # 94 : Amazon Interview Questions 2013 Batch (2)

Round 1
1. BST to DLL conversion.
2. Given a linked list you have to delete all nodes for which there is a node with higher value on right side.
for eg. 41 1 6 4 8 34 3 5 9
output  41 34 9
n^2 solution is obvious. Do this in O(n)

Round 2
I forgot questions from this round. 1 question I remember is
1. You are given with an iPod. There is a sequence of n songs and a function rand(int i) which upon calling returns an integer from 0 to n-1 (or 1 to n, depends on you). You have to write a function so that it will play random songs every time. After finishing one song you have to play another song randomly. The constraint is you cant repeat a song until every song has been played.

Round 3
1. Normal HR questions
2. There are 2 persons jumping from the parachute on a infinite 1 dimensional plane. Upon landing they go to a random direction. We have to write a code using a given API which will run on different system, independent to each other so that they cant communication by any mean. The given API contains
moveLeft - moves the person 1 unit left/1 unit time
moveRight - moves the person 1 unit right/1 unit time
noOpt - moves the person 0 unit/1 unit time
isOnTop - returns true if the person is on top of any parachute. False otherwise.
didWeMeet - returns true if they meet. False otherwise.