If these are the type of questions that they feel qualify you, maybe it's a good thing that I don't work for Google. I, for one, am sick of programming interviews where they test aptitude by giving you riddles that end up getting posted online, so that interviews become more of "have I heard this question before or not" than a true measure of intelligence and motivation.
A better interview question: what's your Github username?
I've had several interviews for internships with Google, and I've never had a single question like these. Lots of data structures and algorithms, never a single riddle. Like I said, these interviews were for internships, but I would be surprised if they ask those kinds of questions for full-time jobs but not for internships.
Data structure and algorithm questions can be more or less like riddles though. For example, the question about finding a loop in a singly linked list is a bit like a riddle.
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?"
I was skeptical reading these questions, because when I did phone screen at Google, I got very practical questions about map reduce and skip lists. I do know that many companies still use riddles like these, however.
I was asked a "crossing a river with a box and two locks" question when I interviewed for a full time database development position (database engine, that is). The question was related to public key encryption... which was something the position never even came close to requiring.
And creating your own encryption protocols from encryption primitives is easy to get wrong, even after you figure out something that seems to follow the rules, because of all sorts of gotchas.
I first heard several of these questions specifically from multiple friends that were doing interviews at Google and were asked about them during their interviews. This was 2-3 years ago. Has their policy changed since then? I'm sure the questions vary a lot by manager. Perhaps some of them simply reference what's familiar.
I'm having difficulty seeing how these questions would help find people who can build great software or solve problems creatively:
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.
I think there are two ways to look at (b). I'd agree that generally the problems we all solve are not particularly time critical, when you're working on something over a week or month, there's not going to be anything which needs doing in ten minutes. On the other hand, when you're supporting live systems, there can be times when being able to diagnose and fix a problem in a few minutes, under pressure, can be a valuable skill. It's at times like that that you need people who can solve problems quickly in stressful situations. I'm not particularly saying that these types of questions will help you find those people, but if it's something you want to test for then they may be 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.
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.
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?
I love the "Boys and Girls" question, because most people get it wrong first pass, most computer science folks would get it after a few minutes of work, and a Bayesian would immediately nail it.
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...
These are all interesting but don't prove you're a good software guy. I don't like the way how some companies try to look "cool" and do the opposite of corporates where you have to get your certifications and grades right opposed to your Brain Academy or the like highscore.
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.
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.
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.
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.
For the question “How old are my children”, arent a lot of possibilities neglected? eg – Why arent there any children with age 1?
9, 8, 1
24, 3, 1
18, 4, 1
36, 2, 1
12, 6, 1
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'm not sure that the riddle questions were ever "real" interview questions.
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".
36 comments
[ 5.9 ms ] story [ 83.4 ms ] threadA 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.
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.
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.
Well, it is trivial with two balls, once you get it, but it's tricky with respect to "just binary search".
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...
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.
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.
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".