Tuesday, September 30, 2008

Amazon Interview questions

Hi,

I had the first round of phone interview with Amazon.
Interviewer asked me only 3 questions. Almost all telephonic interviews will be of one hour duration.

Question asked were
1. Given a very small array and a very big array, how do you find the intersection among them.
Ans. I answered him saying that i will have one hash built on the smaller one and use the bigger array and check if there are intersections.

2. How do you find the first 20 smallest elements in a very big array
Ans. Use some datastructure to sort first 20 elements in the big array, then for each subsequent element, check if it is bigger than the last element, if so, discard it, othersiwe store this and discard the largest


3. Given the arrival times and departure times of flights for past 24 hours, determine how many stair cases you need to serve the aeroplanes.