Thursday, November 17, 2011
Cleared Amazon first round
I had amazon interview on friday 11th, November 2011 and I am glad that I cleared the first round.
The first question was easy - It had to do with the mod (%) operator.
For 1 to 100 numbers, if multiple of 4 comes in, print "fu". if 6 comes in, print "bar", if 4 and 6 comes in, print "fubar".
The answer was pretty straight forward.
The second questions was a Design Question on the Deck of Cards.
Like what all classes you need for the Deck of Cards.
The Third question was how to implement a game like solitare. I havent played the game yet, but I managed to get the correct answer.
I mentioned about arrays for the deck of cards since it makes sense to use arrays since it doesn't require resizing when we have only 52 cards.
The catch in the question was how do to implment the game - Like when u take the first card from top, and put that in the bottom.
He asked me how to code this! I mentioned we need to use two pointers, one which keeps track of the top of the deck and other which keep track of placing the card back to the deck of cards.
The last question was on Louis number which I had no clue when he asked. It was more like fibinocci series. He asked me the Time complexity of the algorithm which I screwd up. The Time complexity for any recursive function like fibinocci is exponention (0)2 power N.
I am glad that I cleared the Amazon Interview. :)
Adios.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment