Live data from Hacker News

Google Interview Questions

mytechinterviews.com

21–30 of 37 posts

Re: Google Interview Questions

#21
I interviewed with Google for a C/C++ job in the team that runs Google Translate and wasn't asked any puzzles or riddles. They asked me to solve some programming questions -- how would you approach sorting a data set too large to fit in memory, using 4 computers -- describe an algorithm for doing this or that -- etc.

Re: Google Interview Questions

#22
post #19

Hi5 SDE used to get asked the "How Strong is an Egg?"/"Drop Two Bowling Balls from a building" question. Not sure how this proves anything.

just wondering for this question("how strong is an egg"), i think binary search will be the minimum tries, so its quite useful.

That turns out not to be the case. Binary search doesn't help, binary doubling doesn't help, even though these are often thought to be the best. Indeed, the solution given on this site used binary doubling and claimed it to be optimal. It was wrong. It was posted here some time ago.

The solution, once found, is simple to prove optimal, but most people don't seem to know how to do that.

Most people don't find it.

Re: Google Interview Questions

#23
post #14

I got the 5 pirates one when I interviewed at Trilogy.

I hate that one. It seems to rely on these "pirates" being hardcore mathematical logicians and rule-followers. Can you imagine a pirate, one out of five, "suggesting" that a good distribution was him 98, two of the others 1 each, and the other two zero? WTF? I'd cut off his head on pure principle! A better "real world" solution would be 40 + 30 + 15 + 10 + 5 or something.

Yea, I posted on the answer page for this. Giving your "2nd in command" (pirate 4) zero gold is foolish if your prime objective is to not die.

Humans, especially Pirates don't care about maths in these kind of scenarios, zero gold would be considered an insult.

Re: Google Interview Questions

#24
There is a book that has some of the same questions, and a lot more. It's "How would you move Mount Fuji" by William Poundstone (http://www.amazon.com/Would-Move-Mount-Microsofts-Puzzle/dp/...). As stated in some of the comments already posted, asking this kind of questions in interviews is by now "deprecated" (or even "considered harmful"), because they are in the public domain.

Re: Google Interview Questions

#25
post #14

I got the 5 pirates one when I interviewed at Trilogy.

I hate that one. It seems to rely on these "pirates" being hardcore mathematical logicians and rule-followers. Can you imagine a pirate, one out of five, "suggesting" that a good distribution was him 98, two of the others 1 each, and the other two zero? WTF? I'd cut off his head on pure principle! A better "real world" solution would be 40 + 30 + 15 + 10 + 5 or something.

Not that I ask it, but it's a question about induction, not psychology. They are "pirates", not pirates.

Imagine if the interviewer instead asked "Convince me you know induction." as that's what they are really after. Without a framework to hang the answer on, it becomes a lot harder.

It's a bad question because it has fallen into the "riddles with memorized answers" category, but not because the skills necessary to solve it are useless.

Re: Google Interview Questions

#26
post #19

Earlier quoted context omitted.

just wondering for this question("how strong is an egg"), i think binary search will be the minimum tries, so its quite useful.

That turns out not to be the case. Binary search doesn't help, binary doubling doesn't help, even though these are often thought to be the best. Indeed, the solution given on this site used binary doubling and claimed it to be optimal. It was wrong. It was posted here some time ago. The solution, once found, is simple to prove optimal, but most people don't seem to know how to do that. Most people don't find it.

For N balls, the other balls can/should be binary searched. It's just a little tricky when it comes to the last two..

Re: Google Interview Questions

#28

Earlier quoted context omitted.

That turns out not to be the case. Binary search doesn't help, binary doubling doesn't help, even though these are often thought to be the best. Indeed, the solution given on this site used binary doubling and claimed it to be optimal. It was wrong. It was posted here some time ago. The solution, once found, is simple to prove optimal, but most people don't seem to know how to do that. Most people don't find it.

For N balls, the other balls can/should be binary searched. It's just a little tricky when it comes to the last two..

  > For N balls, the other balls can/should be binary searched.
Interesting assertion. Can you prove that? Can you give a provably minimal search pattern?

  > It's just a little tricky when it comes to the last two.
Another interesting assertion. It seems to me that the case of exactly two balls is trivial, once the solution is found.

Re: Google Interview Questions

#29

Earlier quoted context omitted.

I hate that one. It seems to rely on these "pirates" being hardcore mathematical logicians and rule-followers. Can you imagine a pirate, one out of five, "suggesting" that a good distribution was him 98, two of the others 1 each, and the other two zero? WTF? I'd cut off his head on pure principle! A better "real world" solution would be 40 + 30 + 15 + 10 + 5 or something.

Not that I ask it, but it's a question about induction, not psychology. They are "pirates", not pirates. Imagine if the interviewer instead asked "Convince me you know induction." as that's what they are really after. Without a framework to hang the answer on, it becomes a lot harder. It's a bad question because it has fallen into the "riddles with memorized answers" category, but not because the skills necessary to…

They are "pirates", not pirates.

I dig where you're coming from but this is kind of my whole point. Humans are humans, you cannot just ignore psychology. You are being asked to predict human behaviour. The "correct" answer is ridiculously unrealistic. Who is better - the guy who is competent at induction, or the guy who realises that human interaction is rarely, if ever, guided by such black and white rules?

Re: Google Interview Questions

#30

Earlier quoted context omitted.

For N balls, the other balls can/should be binary searched. It's just a little tricky when it comes to the last two..

> For N balls, the other balls can/should be binary searched. Interesting assertion. Can you prove that? Can you give a provably minimal search pattern? > It's just a little tricky when it comes to the last two. Another interesting assertion. It seems to me that the case of exactly two balls is trivial, once the solution is found.

Sorry, can't find the link, but it was a Topcoder problem at least 5 years ago.

Well, it is trivial with two balls, once you get it, but it's tricky with respect to "just binary search".

Post reply on HN