Friday, May 8, 2009

Amazon.com phone interview

Well, today I had a phone interview for a SDE position at Amazon.com. Unfortunately, I have been putting out fires at work for the past 2 days and really wasn't in a good frame of mind to think about data structures and algorithms and Big O notation. A sample of questions...

Q1. In Java write a function that will scan an array of int for a value that occurs an odd number of times, specifically once, and return the value. Only 1 number in the array will occur an odd number of times, the rest will occur an even number of times. What would be the runtime order of magnitude of this solution?

Q2. Design a set of classes organizing a bank of elevators and to manage and control them.
Use case1: on floor X, a person presses the down button. How do your class designs handle this?
Use case2: a person enters an elevator on 8th floor and presses the button for 2nd floor, but the elevator is still going up. How do your class designs respond to this?

Q3: Given a table that contains company names and revenue columns, with more than one row for each company name. Design a SQL statement that will return only 1 company name and the corresponding total revenue?

Since I wasted too much time on the first question, thinking about what are some elegant ways to solve that problem, but coming up blank - I was still thinking about how to get one of my teams' Dev servers back up on the network and functioning again. I started to come up with a brute-force solution, but we had to move on to other questions. I got through the others fairly well. Of course, after the interview was over and while getting the server to stand up again, I came up with a solution. But by this time, it's an hour too late since the interview was over. Major screw up on my part, but the real world got in the way of preparing for a great opportunity. Amazon will probably never want to talk to me again...

Hopefully, I'll get another chance to speak with them...