August 3, 2006

Tough Questions From Google Job Interviews

There are many stories about job interviews at Google. But the most interesting part of any story is the list of questions:

Zach had a phone interview in October 2005 and he was asked things like:

"Google gets queries from around the world. Write a function that will return a two character string representing a country code given an IP address as its input."

Here is the answer:

"Essentially, you have to create a tree structure with the country codes as the leaves at the very bottom. I chose to split the IP addresses by octets. So the top level would contain all of the starting and ending numbers corresponding to the first octet on the IP address. So this tree structure would be very wide but only 4 levels deep."




Pete Abilla was a little luckier and knew how to answer this question:
"You are at a party with a friend and 10 people are present including you and the friend. Your friend makes you a wager that for every person you find that has the same birthday as you, you get $1; for every person he finds that does not have the same birthday as you, he gets $2. Would you accept the wager?"

"The answer has to do with the number of days in the year and the probability the person’s birthday falls on the same day as mine (without replacement). I eventually solved it, but it took time learning how to apply probability with no replacement."




An interesting problem from Google's aptitude test:
Given a triangle ABC, how would you use only a compass and straight edge to find a point P such that triangles ABP, ACP, and BCP have equal perimeters? (Assume that ABC is constructed so that a solution does exist.)




The moderator of gamedev.net had a phone interview with rather odd questions:

Explain a database in three sentences to your eight-year-old nephew.

How many gas stations would you say there are in the United States?

You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?





Niniane Wang, who works at Google, has some tips for a job interview:

# Practice using the same medium (e.g. paper and pencil) and time limits (e.g. 30 minutes) as the real interview.
# During the interview, don't obsess over little mistakes that happen.
# Don't be rude to your interviewer.
# Don't hijack the interview (if you really want to talk about a project, ask your interviewer).
# When answering questions expecting a specific answer, give a high-level summary first.

So if you want to work at Google, get ready and good luck!

20 comments:

  1. what's the answer to the glass blender question?

    it kept me busy for a while.

    ReplyDelete
  2. Pull on the end of one of the blades. The weight of a normal person should be enough to tip the blender over.

    Mo

    ReplyDelete
  3. Nonsense. It says the mass is proportionately reduced so that the density remains the same. That means you'll weigh about as much as a large housefly.

    Is that the official answer, provided by Google?

    ReplyDelete
  4. probab you could go and try sit at the centre of the blades as I guess it's a safe place.

    ReplyDelete
  5. The blades of a blender don't touch the bottom of the jar. So, craw beneath the blades and site tight. Since it's empty, nothing but a lot of air will come under. And since blenders are designed to draw food towards the blades, the air passes thru the blades and under, hence you won't be sucked back up.

    ReplyDelete
  6. Yeah but you'll be stuck there! I say climb out, it should be sloped and scratched up which will make it grippy.

    ReplyDelete
  7. I think you say your prayers and meet death like a man. You are a now a gnat does it really matter if you survive?

    ReplyDelete
  8. grab one of the blade, and have a twist of life!

    or maybe pee to short xirxuit the connection.

    yikes, if you are fast enough :P


    ngtitao@yahoo.com

    ReplyDelete
  9. i will start doing toilet.if luck permits I start floating in it and hence save my life.a better option than just dying.

    ReplyDelete
  10. First look at the question again:

    You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?

    This question is like a traditional software problem - the problem isn't that the answer isn't complex, but rather the question should be answered by another question based on a possible assumption: what is the orientation of the blender? The original question does not state whether the blender is in an upright position or on its side; of one thing we are certain: the blender is NOT upside down, the person is "...thrown..." into the blender, which implies the blender has open access. Ergo, one could say the blender is either in an upright position, or on its side. However, the word "...thrown..." also implies that the blender is in fact on its side, since one does not *throw* an object down, but rather *drops* an object down.

    Assuming this blender is in fact on its side, the final response to this question is simple: just run straight out of it!

    ReplyDelete
  11. "Google gets queries from around the world. Write a function that will return a two character string representing a country code given an IP address as its input."

    Here is the answer:

    "Essentially, you have to create a tree structure with the country codes as the leaves at the very bottom. I chose to split the IP addresses by octets. So the top level would contain all of the starting and ending numbers corresponding to the first octet on the IP address. So this tree structure would be very wide but only 4 levels deep."



    This answer doesn't seem very logical to me.... if the tree isn't very deep.. than at each level you have many more comparisons to make...

    a binary search tree is extremely efficient, because at each node you are cutting your possibilities in half..

    ReplyDelete
  12. ok so i am shrunked to a size of a nickel and what do i do?I would climb on the blade,and when the blade starts to spin the wind from the blade would shoot me out...of course counting on my reduced mass that is proportionally reduced so as i maintain my original density.

    ReplyDelete
  13. "Google gets queries from around the world. Write a function that will return a two character string representing a country code given an IP address as its input."

    An IP has for separate parts AAA.BBB.CCC.DDD. All you would need to do is have a tree with 4 levels each with 256 branches. Simple sorting.

    I'm not entirely sure but i believe that the AAA and BBB levels are different depending on the country and the demand from that country.

    ReplyDelete
  14. assuming a height of 180 cm with a weight of 60 kg..
    a 1 cm guy weights around 333 gms..
    so throwin urself on the walls of the blender cn actually make it fall..
    n u r done...

    ReplyDelete
  15. The only way to survive in the blender is if you somehow moved as fast as the blades did. The only way to do that is hold on to the blade and sit tight. But you can do better than that - To take advantage of the centrifugal force simply walk on the blade towards the center and then hold on to the blade tight for your dear life. You have done everything you can scientifically, after that God be with you.

    ReplyDelete
  16. the birthday question is pretty easy.
    You've got 8 possible "matches" (since there are 10 of you, including you and your friend).

    To make money on the bet requires that six of the eight have my birthday (+$6) and that two do not (-$4) for a net of +$2.

    That's absurd. Unless the party is a gathering for people born on my birthday.

    This problem probably tries to confuse the interviewee who vaguely recalls the "birthday conundrum" that in a room of 23 randomly chosen people there is about a 50% chance that 2 people share a single birthday.... and yes, I did have to look up that last bit.

    But the odds as presented are a sucker bet, for sure.

    ReplyDelete
  17. one answer I thought about: i would explode

    explanation, I can't wait to be crushed, as I am shrunk, i pre-suppose, I have same energy to explode back to my normal body and break open the blender!

    anyhow, cool! pray for a power failure!

    ReplyDelete
  18. "assuming a height of 180 cm with a weight of 60 kg..
    a 1 cm guy weights around 333 gms..
    so throwin urself on the walls of the blender cn actually make it fall..
    n u r done..."

    You are thinking of an 1 cm person whose width & depth is the same as the 180 cm person's :p People generally tend to be three dimensional, you know...

    The density of the human body is ~1g/cm^3, so it's ovious a person 1cm high is less than 1g.

    More exactly: a 60kg person is 60,000 cm^3, with 180cm height he has a surface area of 333 cm^2 averaged, or let's say if he's a cube, he has the measures of 10x33x180 cm. So we divide all his sides by 1/180, he's 0.055x0.183x1 cm, or 0.01 cm^3, which is 1/100g. Hardly enough to tip over anything...

    ReplyDelete
  19. "More exactly: a 60kg person is 60,000 cm^3, with 180cm height he has a surface area of 333 cm^2 averaged, or let's say if he's a cube, he has the measures of 10x33x180 cm. So we divide all his sides by 1/180, he's 0.055x0.183x1 cm, or 0.01 cm^3, which is 1/100g. Hardly enough to tip over anything..."

    Really?!?!?! Why would you shrink all sides? They say "You are shrunk to the HEIGHT of a nickel and your mass is proportionally reduced so as to maintain your original density."

    They clearly only use one dimension, not 3. Therefore, assuming the same "cube" of 10x33x180 cm^3, we divide the height by 180 ONLY! Therefore, we have 10x33x1 since we are not the same size as the nickel, just the same height (all other dimensions are preserved) and I believe it comes to 330 which is "a 1 cm weights around 333 gms...".

    ReplyDelete

Note: Only a member of this blog may post a comment.