Thursday, April 15, 2010

Onsite Interview in Seattle


Well !! I always had hope that I will make it to this level. But it's Amazon! You never know. I was on cloud 9 when I got a call from HR , informing me that they are flying me down to Seattle for on site interview. 

Well, on site interview with Amazon are really difficult to tackle. I went through lot of blogs, web sites etc etc. They take 5 back to back 45 min interview at their Seattle office and all of them are usually technical. To prepare, this time , I found new book. Algorithms and Data Structures by Steve Skienna. It is a very good book. But eventually it dint turn out to be very useful again. So back to 'Programming interviews exposed' and www.careercup.com(these two rock).  This time while studying , I was making notes also so that I can read while traveling and in the Hotel.

It took some time for HR to arrange an interview. My interview was scheduled on 13th April, 2010 and I was supposed to fly on 12 th April(Monday). But I got the ticket confirmation on Sunday night. But I was prepared , so it dint take me long to get ready and I flew to Seattle on Monday evening. While flying to Seattle,  I met a local resident sitting next to me. He promised me that , he will have me city tour after the interview. I reached hotel at 11 pm local time. Amazon really take care of you. The Hotel was excellent and I had booking for 3 days with all expenses paid by Amazon. I got into hotel , got fresh and studied a bit. My interview was at 10.45 am next morning so I went to sleep.

I reached at Amazon office at 10.15 am. Their building is huge but the office insite was very very simple. They believe in saving money on such stuff. At 10.45 , one of their HR came and took me to a conference room. It was just a basic HR interview asking very basic questions for 10 mins. I dont even count that as interview. Well it was time for Marathon to begin.

At Amazon, interviewers come to you. I was in the conference room and the interviews came in one by one at me.

Interview 1: First comes the Software Project Manager. He is working with Amazon for past 4 years. He told me about the Amazon.com and  Payments department(where I applied) for first 20 minutes. It was such a great information. I really got to know what Amazon.com does. He also told me some internal things which he shouldn't have told(he said that). Then he asked me "Are you interviewing with anyone else?" . Well, being most honest , I told him that I am interviewing with Microsoft as well(Yes, I have call from Microsoft). He mentioned that they are our competitors. After that , he asked to explain one of my projects. I think explained him the project fairly well. He asked me lot of questions , but I was able to answer them. At the end, he asked me a technical question. Find first non-repeated character in an input string. I knew the answer and I wrote the program , with some errors, which I corrected later.They know that it is hard to write program on white board and visualise errors. They just see your approach and help you make your program error free. The interview went well.

Interview 2:  Then comes a Software Engineer. He is working with Amazon for past 5 years. At Amazon , you have the choice whether to have promotion or not. He chose to SDE for five years. He started with a question , "Given two strings , find whether they are anagrams'.  I dint know the program. But I used the hash array logic and solved it. He asked to write the program on dashboard. I wrote it. He then pointed out some errors and I corrected them to improve time and space efficiency. We spend some time to discussing on these issues. After that , he asked me next question, " Given 1 million and 1  numbers, containing duplicates except one number which is unique. Find it". I knew the problem but I thought on it for some time, did some calculations on board and told him the solution(exor). He was surprised that I gave this solution, may be he dint expect. I said , I knew the concept that 'use  exor to eliminate duplicates'. He said, there is one more solution with Hash Tables. I said , of course yes but it is not ideal for 1 million numbers. Then, he said , we are finished early, so he told me more about the company and his roll. This interview also went well.

Interview 3:  The next interview was with the team manager,  a lunch interview. He asked me what food do you like, so I said I like chinese. So we walked to a chinese restaurant. He started asking questions , regarding my education and stuff. He was very pleasant in talking and I felt very nice. In the restaurant , I ordered Chicken fried rice( safest thing you order while on lunch interview). Then the interview continued. He asked me 'Are you interviewing with anyone?' . I acted like shying. So he added, " If you want to share! Otherwise it is fine". I said, I am interviewing with Microsoft as well. Even he mentioned that they are our competitors. Then we started eating and he continued to ask questions like, mention some data structures, differences , what is primary key in SQL etc. He also asked me about how to find a prime number. So I took this chance and discussed the various methods of finding a prime number(best one being sqrt ). I told him how I came to know this method and how I tested it. He asked me to write the code for it on paper. He set aside my plate and I wrote the program. Then we talked about one of my projects.  I couldnt complete my lunch , but  I dint want to eat much so I said I am done. Then we headed off the restaurant and came back to conference room. There he told me about his roll in company and some more about Amazon.com

Interview 4: Next comes the bar raiser. I don't know yet whether he was he or she. I was surprised a bit but dint care about it at all. My Goal was to do best at interview. Generally bar raisers are really tough and they make sure that you have enough potential to work for amazon. He/She started with asking questions about my previous experience. I answered him but , he wanted more information. I explained him whatever I knew and remembered. Then he asked me the technical puzzle " Give coin denominations and an amount. Find mininum number of coins to make that amount.". Man, I had read this puzzle , but somehow I totally forgot it(worst thing ). But I remembered , at Amazon they just see your approach, they dont expect you to solve every question. So I kept cool, and gave solution with greedy method. He gave me many counter examples and I came up with another solution. I kept on talking a lot and it was more of a discussion. Eventually I gave him a solution combining two of my methods. He thought a lot and said that he is not able to find counter example for this.  I said this should work in all cases but he dint look satisfied. So he told me his solution, the tree based one. Well I realized that , this was better solution. He asked me to code it. I started coding, but during he confused me a bit. Then he suggested me an approach with BFS(Breadth First Search Construction) and asked me how could that be done. So I explained him the BFS algorithm and coded it finally.  I did really bad on this interview. I was really disappointed with myself. But I did whatever I could at my best.

Moral of the story is , even if you dont know the answer , come up with something and explain them your thought process.

Interview 5: Then comes an Indian guy. He looked too young. He was there for just two years. He had my resume in his hand and I saw all 'SQL' circled. I thought what was coming. So he asked me to design database for facebook. This interview was more of a discussion session. He told me initially 'purpose of the interview is to see your thinking and not correctness'. So we started with the basic table for facebook users and its attributes. Then we discussed some real world scenarios that could happen with facebook registration and he asked me how would you solve this at database level. I answered them satisfactorily with some hints. Then he asked " How would a database fo friends network look like?" I gave him a tree structure. But he wanted an answer that could be implemented in databases. So I gave him a table with 5 columns where each. But he said ideal answer is table with two columns, but you are close. Then he asked me various different techniques for friend suggestion. I gave him various solutions that I could think of. Finally , since we had two tables, he asked me to write combined query , I wrote 2-3 different queries as he wanted(joins , Cartesian products, simple queries). I think he looked satisfied. I asked him some questions too. He told me about his work at Amazon. He also mentioned that he did intern in TCS back in India. The interview went fairly well.


Interview 6: This was the last one. In comes another Indian guy, but just a little older than previous guy. He told me about his roll at Amazon.com and asked me ' Given an array and a number, find whether there exists a pair whose sum is the given number.' He also mentioned that , he is going to take notes of what I will do. So , first I told him how I would solve this problem using hash tables.. He asked to code it and I started writing code on the board. I was talking a lot(deliberately). I wrote the code in java. The solution was correct but he found some breaks to that program and then again I thought and solved the problems. He did not seem to understand the solution so I explain him again. He also asked me questions on hash table In the whole interview I talked a lot and he was writing something on his laptop. After some explanation he understood what I was saying. Then again he gave some more break points and I solved them after little effort. Then he asked me for any other solution. So I gave him the solution of sorting. He asked general questions on sorting and then asked me code it. I coded it correctly and he said ok. Then he asked me the next question 'Given a number, find whether its bit representation is palindrome or not'. I knew the problem. I thought for a while , did some binary calculations on board and came up with a solution and explained him. He was quite pleased with the solution but he dint show it. He asked me to find the breaks in that code. I ran th code on different inputs , but it was running ok for all inputs. Finally I asked few questions to him and then he took me downstairs and told me that I am done and now can leave. 

At that time  I was at the position where I could have given 2-3 more interviews ;) . And I was thinking that I had only 5 interviews. When I started writing this blog , I realized that I actually had 6 interviews.

I went to Hotel and got some sleep. In the evening , I texted the guy I met in airplane. He is American born Filipino guy.  He came to pick me up at the hotel. We had a dinner in a Mexican restaurant and then he drove me all over city for around 30-40 minutes showing various places. It was really nice experience. I must say , he was a really nice guy and I discussed lot of things since even he had some IT background.

I came back to Lubbock next day. It was over all a great experience but I did not do well on one of the interviews - the one with bar raiser. I still feel that I should have done little better. I have mixed feeling.  But neverthless , Keeping my fingers crossed , I hope for the best. I will keep posting as soon as I make any progress.

Wednesday, March 24, 2010

Second Phone Interview - Amazon

Well well well ! I don't know which algorithm they use for evaluating candidates , but certainly < O(log n)( that means faster). I mean, I got a call for 2nd phone interview on Friday. I had little expectations, but Amazon is quick. So I set up the interview on Wednesday(again !). But as usual , I did not study ( at all) on weekends.

I have always heard that Amazon interviews get tougher as you proceed. Especially the 2nd phone interview is really a hurdle. This time I decided to prepare really hard(eventually , as expected, it did not happen). Again went through lot of blogs , web sites. One of my friend asked to me read book 'Programming Pearls'. Again same process. Downloaded it from www.filecrop.com . I did not find it very useful though. I chose to refer Programming Interviews Exposed, Complete Reference Java 2 and Art of Computer Programming - Sorting and Searching by Donald Knuth.(My ebook reading speed is really good by the way ;) )

On Wednesday , I got a call from them; this time they were 9 minutes late. Rare ! Hilton Campbell was on the phone. I expected a voice of lady, but it was 'he'. He is a Software Developer Engineer at Amazon for past two years. Anyway, first, he asked to explain my best project. Once again, I explained the same project which I explained in 1st interview(Rule Based Stock Trading System C++).

Then he asked to write a function for nth Fibonacci series. I wrote the recursive functions in 2-3 minutes. Then he asked me if there is any error and complexity. I corrected one error when input is negative. Honestly, I did not know the complexity of Fibonacci series. So I said its constant. But he gave me some hints, with which I could answer correctly. Then he asked me write non recursive logic. I wrote that too, with some hick-ups. I should have studied Fibonacci more carefully. It was a worst start I could ever imagine.

Then he asked me What is polymorphism. I explained it very well with examples of function overloading and function over-riding. He was satisfied with the answer. Then he asked me design object oriented design for Car. Well I designed classes like Engine, Tyre, Transmission, Parts , Car. Also mentioned the member variables and methods for each class and their relationship. Then he asked for more functions. I revised the design as per his requirement. Again, he was quite pleased with the answer. They just see your approach.

Next, he asked question on files(Unix). There are 50,000 html files. Some might contain phone numbers in different formats. List all the files that contain phone numbers. I knew the answer already, I acted like I did not know. I said I would use command grep with regular expression for phone numbers for *.html . Again , it was correct answer. I told him that , I dont exactly know the syntax of command, so he asked me how would you find it?. I answered that I would use 'man' grep. Then he asked me some more unix commands(which I already knew ;)).

Next, he asked to describe hash tables. I explained the hash table with an example of function %8(mod 8) for 8 element hash table. Then he asked me about various complexities of hash table and I was able to answer them.

Then , he asked to write a function to return whether the number is power of 2 or not. Again , I knew it already. But, I took 1 min to write the function and explained it. He asked me whether I already knew the problem. So I said no, but I had observed the bit pattern of power of two and a number 1 less than it. Using that pattern we could solve the problem.

Finally, he asked me if I have any questions. I asked him couple of questions like, What do you do at Amazon? How much exposure is provided to SDE at Amazon? etc. It was supposed to be 1 hour long interview, but got over in 38 minutes.The interview went well, but I really screwed it up with the simple Fibonacci problem. Keeping my fingers crossed, I am hoping for best. I will keep posting as soon as I make any progress.

Thursday, March 18, 2010

First Phone Interview - Amazon

My First Phone Interview With Amazon

I never expected to get a call from Amazon ,through Dice. Though I was so happy to hear that I was shortlisted for interview. I scheduled the interview on Wednesday , so that I get enough time to prepare.And I went to Sea World - San Antonio on weekend.

First step, to prepare, I googled 'Amazon Interview Questions'.... and whoaaaaah, many many results. I went through lot of websites, blogs(one of them inspired me to write this blog ;) ) . It always helps to have an idea about the interview beforehand. I came across a blog , where I found information about the book 'Programming Interviews Exposed' and strightaway thought of having it. Now, being an Indian Software Techie , I thought of having it, not buying it. Logged on to www.filecrop.com and downloaded the book for free. I wish, this habit wouldn't have been there in my blood. Nevertheless, I am proud of it.

On Wednesday, I got a call from them; they were pretty much on time. 'She' (Qin Chen) was a Software Development Engineer at Amazon for two years. Started with asking me ,Why Amazon? Luckily , my girlfriend had told me that Amazon was listed amongst three Dream Companies , in Forbes magazine last week, so mentioned that. Then she asked some questions on resume, my previous work experience and then asked me to explain one of my projects. I think I did that well.

Then She asked me some programming questions on java. What is difference between Final, Finally and Finallize? What is difference between == and equals? Primitive types in Java? I answered them satisfactorily. Here comes the hard part, she gave me a series( A, B , C, D, E... Z, AA, AB...AZ... BA, BB,......). I couldn't understand the series for 5 mins and she went on explaining. I must mention that she was really cool and dint give up until I understood. To make it straight, she asked me to open excel sheet. The column names in excel sheet represent that list. Task was to return n th string in the series. Once I understood the series, I was able to pseudo code within a minute. She told me that your approach is correct , but code and send it to me( I did it after my interview).

Then she asked me to design an Object Oriented Model for a Movie Theater. The purpose was to return nearby theaters, given zip code and movie name. I was able to to design two classes and explain her. I think she was convinced with what I explained. I would like to advise you all , to prepare OO designs for real world objects beforehand(For eg. Cards, Elevator, Parking lot)

Finally, She asked me whether I have any questions. I asked two three questions, one of them being " How good is Amazon to start career with?" . I think , the interview went well, but I did bad at some things. Keeping my fingers crossed, I am hoping for best. I will keep posting as soon as I make any progress.