Answers To 15 Google Interview Questions, Makes You Feel Stupid

6:58AM November 17, 2009 | The Business Insider

Interviewing for a job at Google can be a nightmare experience. Reading about Google’s ridiculous interview questions, however, seems to be quite a lot of fun. Either that, or our readers are gluttons for punishment.

Earlier this month, we posted “15 Google Interview Questions That Will Make You Feel Stupid“, their answers and then 15 more questions. Three million pageviews later, here are…

Answers To 15 More Google Interview Questions That Will Make You Feel Stupid

Question: Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announces that at least one husband has been unfaithful. What happens?

Answer from reader Olivier Coudert: The cheating husband problem is a classic recursion pb. Once all the wives know there is at least one cheating husband, we can understand the process recursively. Let’s assume that there is only one cheating husband. Then his wife doesn’t see anybody cheating, so she knows he cheats, and she will kill him that very day. If there are two cheating husband, their wives know of one cheating husband, and must wait one day before concluding that their own husbands cheat (since no husband got killed the day of the announcement). So with 100 cheating husbands, all life is good until 99 days later, when the 100 wives kill their unfaithful husbands all on the same day. Job: Product Manager. Photo: symmetry_mind

Question:If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?

Reader ru offers this answer: The trick here is that .95 is the probability for 1 or more cars, not the probability of seeing just one car. The probability of NO cars in 30 minutes is 0.05, so the probability of no cars in 10 minutes is the cube root of that, so the probability of seeing a car in 10 minutes is one minus that or ~63 per cent Job: Product Manager

Question: Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one torch and it only has enough light left for 17 minutes. The bridge is too dangerous to cross without a torch, and it’s only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in one minute, another in two minutes, the third in five minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes?

Answer from an anonymous reader: One and two across (two minutes); one goes back (three minutes); five and 10 go across (13 minutes); two goes back (15 minutes); one and two cross (17 minutes) — and everyone’s safe and sound. Job: Product Manager. Photo: Jule_Berlin

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?

Answer: Ignoring seasonal upticks in births, there’s about 1/365 probability that any other person has the same birthday as you and 364/365 chance that any other random person does not. Do not take this bet. Job: Product Manager

Question: If you look at a clock and the time is 3.15, what is the angle between the hour and the minute hands? (The answer to this is not zero!)

Answer from reader Matt Beauchamp: 7.5 degrees. Every minute on the clock represents 6 degrees (360 degrees/60 minutes). Every hour, the hour hand moves from one number to the next (in this case, it is moving from 3 to 4) which represents 30 degrees. Since it is exactly 1/4 past the hour, the hour hand is 1/4 of the way into its 30-degree trip or 1/4 or 30 degrees… which is 7.5 degrees. Job: Product Manager

Question: What is the probability of breaking a stick into three pieces and forming a triangle?

Since this question doesn’t say the sticks must intersect at their tips to form the triangle, the answer has to be 100 per cent. Any three sticks of any size can make a triangle. Job: Product Manager. Photo: markhillary

Question: There’s a latency problem in South Africa. Diagnose it.

This is obviously an extremely vague question, and there isn’t really one correct answer. A good answer is one in which the interviewee demonstrates familiarity with the term “latency” and enough imagination to come up with an interesting problem with an interesting solution. Job: Product Manager Photo: warrenski

Question: How many lines can be drawn in a 2D plane such that they are equidistant from three non-collinear points?

Answer from reader Denis: Three. Take any two of the points. Draw a line that is parallel to the line segment made by those two points and halfway between that line segment and the third point. Repeat for every combination of two points. Job: Software Engineer. Photo: Caveman 92223

Question: What’s 2 to the power of 64?

1.84467441 × 1019 This is a pretty easy answer to figure out when you’re not sitting in an interview with no calculator around. Job: Software Engineer.

Question: Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organise your shirts for easy retrieval?

There’s no one answer to this. The interviewer wants to test the interviewee’s imagination and creativity with problem solving. We feel like reader “Dude” might impress a Google interview with this answer: Organise them according to types of clothes like a HASH and then organise each type into a 2-3-4-Tree or RedBlack Tree. Job: Software Engineer. Photo: Brymo

Question: You are given a game of Noughts and Crosses. You have to write a function in which you pass the whole game and name of a player. The function will return whether the player has won the game or not. First you to decide which data structure you will use for the game. You need to tell the algorithm first and then need to write the code. Note: Some position may be blank in the game, so your data structure should consider this condition also.

Answer from reader Dude: The data structure that is required is a two-character dimensional array. Call the function to check the six conditions if there are any winners, the sixth condition is to see if there are any more spaces left. If there is a winner the characters X or O are associated with the players, in this case you need a flag. If there is a winner return the value to the calling function to end the game. If not the run the game. Job: Software Engineer Photo: frozenchipmunk

Question: How long it would take to sort one trillion numbers? Come up with a good estimate.

Here’s another question without one answer. The idea is to test the interviewee’s creativity. We like the simple answer two readers came up with: Merge Sort for sorting. O(1,000,000,000,000 Log 1,000,000,000,000) — Average Case Scenario; O(1,000,000,000,000 Log 1,000,000,000,000) — Worst Case Scenario. I’d guess you can do one billion operations per second, thus 3000 seconds. Job: Software Engineer

Question: Design an algorithm to play a game of Frogger and then code the solution.

The object of the game is to direct a frog to avoid cars while crossing a busy road. You may represent a road lane via an array. Generalise the solution for an N-lane road. Here’s the only answer we found for this one, from site Glassdoor.com: “One approach is to write a recursive algorithm that determines when to ‘wait’ or to ‘jump’ to the next lane, depending if there is an approaching obstacle in the next lane.” Job: Software Engineer

Question: How many resumes does Google receive each year for software engineering?

This is another question that’s about testing the job candidate’s ability to frame the problem in a simple way and then creatively solve it. Our answer: A candiate for Quantitative Compensation Analyst should know that Google hired about 3400 people in 2008. Figure 75 per cent (or 2550) of those hired were engineers and that, like Harvard, Google only accepted 3 per cent of those who applied. 2550 is 3 per cent of 85,000. Job: Quantitative Compensation Analyst

Question: You are given a list of numbers. When you reach the end of the list you will come back to the beginning of the list (a circular list). Write the most efficient algorithm to find the minimum number in this list. Find any given number in the list. The numbers in the list are always increasing but you don’t know where the circular list begins, ie: 38, 40, 55, 89, 6, 13, 20, 23, 36.

Here’s our favourite answer from reader “dude”: Create temporary pointers and start from the root. (Most of the time circular lists have front and back pointers.) Check if front is larger or if back is larger. If front is larger then you know you are at the end of the list and at the front of the list. If front is larger then traverse the opposite direction and compare numbers. If there is no root or a pointer pointing to any part of the list then your data is lost in memory. Job: Quantitative Compensation Analyst


Comments

  • Nathan

    November 17, 2009 at 10:29 AM

    The answer to the question: “What is the probability of breaking a stick into three pieces and forming a triangle?” given above isn’t correct. The issue is that the lengths of the 3 sticks must satisfy the triangle inequality, i.e. the lengths of any two sides must exceed the length of the third side. If we assume that the break points are chosen uniformly at random, then the first one can be placed arbitrarily, while the second must be in the opposite half of the stick to guarantee that the triangle inequality is satisfied. i.e. probability is 1/2.

    • StevoTheDevo

      November 17, 2009 at 12:21 PM

      You assume that all the sticks must be connected end to end..
      I can still make a triangle no matter how short the 2 short sticks are…

      ________________________________
      \/

      • Nathan

        November 17, 2009 at 1:03 PM

        Fair enough, the question doesn’t say anything about avoiding dangling edges. I suspect Google would accept either answer … although yours is certainly faster to derive and explain.

      • Wei

        February 9, 2012 at 12:06 PM

        actually, should be ln(2) – 0.5

        integral([0,.5], x/(1-x)dx) = ln(2) – 1/2

  • jared

    November 17, 2009 at 10:48 AM

    I dont think the answer to your birthday question is correct either, sounds like they are testing your knowledge of the birthday paradox a common term in cryptography. Although the question has limited the range to a pretty small amount, so who knows.

    http://en.wikipedia.org/wiki/Birthday_problem

    • StevoTheDevo

      November 17, 2009 at 12:32 PM

      It’s not quite the birthday problem as linked because it specifies *your* birthday.. rather than any couple sharing any birthday..

      The answer is correct, there is only a 1/365 chance that anyone will share *your* birthday.

      And when you’re giving away twice as much as you receive, just to break even, you’d need 2/3rds of the people in the room to share *your* birthday!

      That’s only ever going to happen at a very special party!

      • orionoir

        November 25, 2009 at 3:34 AM

        the real-life odds of a partygoer’s birthday being the same as one’s own almost certainly is not 1/365. for one thing, birthdays do not distribute perfectly evenly across the calendar (eg, there are more july babies than november.) also, all other things being equal, one’s birthday month tends to slightly influence social attraction. that you’re all at the same party is enough to tilt the odds away from a strictly mathematical ratio.

  • Cpt. Pajama Shark

    November 17, 2009 at 12:28 PM

    My Answers:
    Question: If you look at a clock and the time is 3.15, what is the angle between the hour and the minute hands? (The answer to this is not zero!)

    Answer: 1. Can I borrow a protractor?
    2. Who uses a clock with hands anyway

    Question: What is the probability of breaking a stick into three pieces and forming a triangle?

    Answer. 1. How thick is the stick, and is it green wood or hardwood?
    2. I don’t see any sticks in this inteview room, so i’ll say probability is 0%

    Question: There’s a latency problem in South Africa. Diagnose it.

    Answer: First we’ll need a really big boat. Then we’ll just drag South Africa a bit closer so the 1′s and 0′s don’t have as far to go.

    Question: What’s 2 to the power of 64?

    Answer: 1. Nothing! Absoulty nothing!. I mean 64 is WAY more powerful than 2. 2 is pale in comparrison to the might of 64.
    2. Depends if we are playing golf or cricket.

    Question: Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organise your shirts for easy retrieval?
    Answer: Where did all these shirts come from?, I don’t need so many shirts. Where is the nearest Salvo bin.

    Question: Design an algorithm to play a game of Frogger and then code the solution.
    Answer: No, you do it. I’m going to play Left 4 Dead. Algorithm’s should only really be used to enhance the render of the zombies i’m killing.

    Question: You are given a list of numbers. When you reach the end of the list you will come back to the beginning of the list (a circular list). Write the most efficient algorithm to find the minimum number in this list. Find any given number in the list. The numbers in the list are always increasing but you don’t know where the circular list begins, ie: 38, 40, 55, 89, 6, 13, 20, 23, 36.

    Answer: Who are you? What kind of person goes around handing out lists of numbers? I think you need some help. Come over here and sit down for a while, here have a glass of water.

    *picks up telephone in other room* “Hello, is this Sunny View Phsyciatric Centre?” “oh good, I’m hoping you can help me, we’ve just had this strange gentleman walk into an interview I was having with a potential employer”, “yes, he seemed to be handing out lists full of numbers, it was quite alarming”, “”oh you know this man, great”, “could you please advise on the safest course of action we should take to get him back into your care”, “excellent, we’ll see you when you get here”, “bye, have a nice day”, “oh wait, what was that……yes that’s correct, my name’s Adam”

  • Mr Shush

    November 17, 2009 at 8:04 PM

    Question: Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organise your shirts for easy retrieval?

    Why is it hard to find a shirt when the closet it full of them? Just reach in and grab a shirt, any one will do right? Or are you assuming that there’s a particular shirt you want, I don’t read that in the question.

  • Seattle Interview Coach

    December 4, 2009 at 1:39 AM

    Nice article. I’ve compiled 140 Google interview questions. Check it out here: http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html

Post Your Comments