Google Interview Questions
mytechinterviews.com
mytechinterviews.com
and here: http://terrytao.wordpress.com/2008/02/05/the-blue-eyed-islan...
In fact, a whole book has been written about it and related issues:
http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&...
It's a fascinating riddle because it introduces the subtle concept of "what somebody knows about what someone else knows about what someone else knows about X".
But such a well discussed and complicated puzzle therefore also makes a bad, or at least "unfair", interview question. If you've heard it before, read that book, read Terence Tao's post on it... etc.. you'll easily ace this riddle.
If you haven't heard of it before, it's going to take you way longer than just a few minutes to get your head around it.
So as an interview question, it's testing what you "know", not how well you think.
A better interview question: what's your Github username?
There is also one about writing out a binary tree layer by layer, which really amounts to: "do you know what breadth-first traversal is, and do you get the insight that you can do that on trees too?"
1. These were for APM interviews, not engineers.
2. These questions are no longer asked.
Usually once an interview question ends up publicized on a blog, interviewers don't ask it anymore.
Not sure how this proves anything.
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.
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.Well, it is trivial with two balls, once you get it, but it's tricky with respect to "just binary search".
a) I'm not sure there's a strong causal link between "being good at brain teasers" and "writing awesome code".
b) I suppose they could be viewed as measuring creativity, but it's in a stressful situation. When you're trying to solve actual problems at work you aren't going to be trying to do it in ten minutes in front of an interviewer. Also they're clearly problems with only one correct answer which seems unrealistic in comparison with reality.
c) More precisely, I suspect that this would test for people who enjoy brain teasers and have done lots of them before.
It's an interesting exercise but I think the questions should be focused around what the company's needs are for that role in particular not to test your "genius". f you're a genius and have the good attitude you already created something great that speaks for you.
Maybe it was the case, don't know.
In this case, in addition to the two cases which add up to 14 (as pointed out in the solution), there is another case wherein the ages add up to 13: 12, 6, 1 (sum=13) 6, 4, 3 (sum=13)
Why is this case ignored? Isnt more data required to “break the tie” and get a unique solution?
I got the "12 balls, find the fake" question at an interview once. It seemed to be more a tension killer than anything anyone in the room really cared about. The actual interview was a series of questions along the lines of: "how would you go about doing X, sketch code or pseudo-code on the whiteboard and then explain it".
A better "real world" solution would be 40 + 30 + 15 + 10 + 5 or something.
Humans, especially Pirates don't care about maths in these kind of scenarios, zero gold would be considered an insult.
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.
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?
Plus, it's seems so simple we could pose it to our (non-Dilbert) moms.
Now if only getting this was correlated with good programming...