Posted by: Haroon Saeed | July 19, 2006

Google Phone Interview (Part 2)

My second official telephone interview from Google was with Sanjay Jain, an engineer in
Google, India. He telephoned me at 7.30 P.M PST. And the interview lasted for an hour and thirty minutes on the phone. Actually he had to phone me at 4.30 P.M but due to his travel schedule he missed. So he phoned me at the new time. He sounded an awesome guy who has some 14 years of industry experience. I was quite amazed that he was too agile in thinking and very good at algorithms.

Traditionally he started by asking me what I have done so far. So I explained him my projects and talked about my education and professional experience. He then started the technical questions. The first question that he asked me was about “Coin Denomination Problem.” (Yes the same coin denomination problem that I posted on my blogs). He asked me if I have heard of the problem. I told him that yes I have heard of it. He then explained me the problem again and then asked me to give the first solution that come to my mind. Instantly I gave him the greedy solution which is too trivial. He then inquired of any problem with my solution. I told him the problem and was asked to resolve the issue. Sanjay is a superb interviewer he gave me small hints from time to time, though I was at ease with this problem. I tried to figure out the recursive solution and formalize the recursion, but I was not able to do it quickly. It costed me much time to figure out the solution and I finally reached to the recursion. Now he said me to give the Dynamic Programming solution, which I did in the end.

He then asked me the traditional Google question. Yes the question was based on distributed computing problem. He asked me that there are random arrays on ‘n’ computer. Each of size of RAM of it’s computer. The arrays are not sorted. The problem was to sort the arrays. Now this is a tough question from implementation point of view. One has to take care about a lot of things. Any ways, I started by some old tricks to handle the problem. I came up with many solutions and many ideas, but Sanjay found minor or major problem in most of them. In end we agreed on that we will have to sort them logically, means the problem now remain of intelligently retrieving information instead of actually sorting the arrays. Its was a nice problem indeed.

Then he asked me if I liked puzzles. I said yups! I like them. He asked me that the puzzle he is gonna ask is a tough one and very few have solved it.(Btw I solved the puzzle :) and have never heard of it before). The puzzle he asked was, “You have some nuts and some bolts in random order. You cannot compare nuts with nuts and bolts with bolts. It is guaranteed that a nut will fit in one or more bolts. Now you have to sort both nuts and bolts separately in minimum complexity. ” I kept quiet for some time, thinking extremely about the puzzle. He asked me after some time if I comprehend the puzzle. I said, I am thinking yet. And instantly like a divine thought the solution came to my mind. I used quick sort approach and sorted both in n * log (n). (The exact solution I am not posting it, quick sort is a hint). He was happy with the solution.

At this point I felt some what accomplished and about 1 hour 20 mins have passed. He asked many things about Techlogix, my interviews at Microsoft. He advised me to try at Yahoo and other good companies. He sounded very stable, intelligent and witty in his approach. I talked too much things about Google. He told me that Google India is an exact copy of Google USA and told that he would like to meet me in India if am selected for an offer. On this happy tone this excellent interview ended.

Haroon


Responses

  1. Very good post.
    Even I attended a phone interview and waiting for the second round. Any updates on ur interview results?

  2. Hey kart,
    what questions were u asked for ur interviews…I have a Google phone interview coming up next week for a software Engineer position…

  3. Thank you

  4. Hi i have a telefone interview of gppgle next week…..i have applied for a Soft Engg,I have applied for freshers graduate, what typical questions they can ask on the telephone??

  5. [...] preguntas como las que se comentan en algunos blogs y medios convencionales ([1], [2], [3], [4], [5], [6], [...]

  6. [...] preguntas como las que se comentan en algunos blogs y medios convencionales ([1], [2], [3], [4], [5], [6], [...]

  7. i have a phone interview this friday about database administrator. i have no idea how to prepare for the interview.. any idea freinds?

  8. I finished my phone interview with google. They asked me following questions:
    1. What is the best successful project you have done in your career. explain
    2. How would u define variables in VBA and how would u release the value.
    3. How many mcDonalds are there in Australia.
    4. Imagine you have 10000 computer network and you are the admin of this network. how would you monitor the performance and how would you rectify the problem.

    thanks
    bhavin

  9. Regarding the coin denomination problem, I have got a solution which is faster than the dynamic programming one.

    Here is my solution:

    For each of the denomination index from 1 to max(index),
    calculate how many coins are needed where the coins are from index to n.
    Then calculate for this loop which was the lowest by having a temporary counter.

    not sure if the above is clear. here it goes.

    suppose the coins are 1,17, 201,529, 728 (just being hypothetical)
    The maxchange is 10000000.

    Here is how we have to loop thru 728,529,201,17,1

    1. Take all of the coins and arrive at the solution
    so divide 10000000 by 728.
    The remainder will be divided by 529. The remainder will be divided 201, and so on.
    The total number of coins is the sum of all the integer divisions ie (10000000/728) + (remainder / 529) + (remainder / 201) ….

    2. Take all the coins from 529 thru 1 (exclude the first one – 728)
    find out the total number of coins.
    3. Take all the coins from 201 thru 1 (exclude the first one and second one)
    find out the total number of coins
    4. and so on, finally we will have only one coin – 1 to consider and number of coins will be 10000000.

    Have a minCoins variable with Integer.MAX_VALUE. For each of above iterations above, change value of minCoins to the total number of coins found in each of scenario.

    The main advantage of this solution is, looping is only for the number of denominations not for the amount. In the dynamic programming solution (which is a big jargon) we loop thru the amount.

    This is under the assumption that the denominations will always be less in number, the amount can be higher (which is a good assumption to make. I dont think anyone will face a situation where coins are 1, 5,15,21, 56 and amount is like 10 or 15)

    I have seen that my solution works much faster for higher amount when compared with dynamic programming concept.

  10. great post haroon! good for other people preparing for phone screens.

    Raghavendra your solution is just the greedy solution. In your example, try 1786. The best solution is {529,529,728}, but your algorithm won’t find that.

    Dynamic Programming isn’t just jargon. It’s a technique for solving problems like this. You should read up on it for your next interview :)

  11. I have a phone interview tomorrow
    I applied for an internship.
    Do you think that the questions will be hard. i have a very small experience in java. I am scared to death that i will screw up.

  12. [...] Maybe you will know. [...]


Leave a response

Your response:

Categories