Saturday, August 18, 2012

Amazon interview questions

I st round - Interview


1. Searching an element in a rotated sorted array.

2. Deleting every third element in a doubly linked list

II nd round 

1. Levelwise printing of binary tree and linking siblings in each level. How will you differentiate nodes in each level and other level

2. Record streams are input and we have to find top 100 records. Records are not numbered as 1,2,3...n but it can be any other numbers. 

    Arranging/ordering records based on frequency counts (top n)

3. To find n pages which get the maximum requests. 
Example: consider the requests as 1,1,1,2,2,3,4,1,3,5,6,5,6,5,6,5,6,5,6,........Requests keep on arriving.
    Our coding should give the output as 5,6.(n=2)


III rd round

1. Arrange in a queue, such that for any person x, the person to the left of x should have lost against x and person to the right of x should have won against x. (For any person k and total n persons, k should have played a game against remaining n-1 persons)

What data structure should we use????

2. Threads, synchronization, etc

IV round

HR, Record streaming question again

No comments: