Wednesday 9 November, 2005
Puzzling
There are nine balls, all the same size, but one of them is heavier than the others. Using scales, explain how you can find out which one is the heaviest ball, in fewest moves possible.
I love logic puzzles, but I absolutely suck at them. This is one of the puzzles that's currently used for interviews by my team - I'm so glad that they didn't have this when they were interviewing me. I know what they are after - they want to see how peoples minds work, how they approach a problem and how they can deal with stressful situations. But I'm not sure if this kind of a puzzle is the best possible way of finding out - personally I would just totally panic and probably freeze, I would imagine that they are looking for the right answer and if I couldn't provide that - which I wouldn't - that would be the end of it. Still, I believe I'm good at my job, and I'm good at methodically testing software, and that in my job I'm capable of "thinking outside the box".
On the other hand, interviews are difficult. I don't think there's a foolproof way of finding out only suitable people and dropping the bad eggs. How to get sensitive nervous people like me out of their shells so that they can shine and tell you all the relevant information, and yet still see through all bullshitters and ignore them. For my previous job, in the interview I was given the API for a small Java program and was asked to write a test harness for it - trivial for me as that is my core skill, but it would be impossible to do in a short space of time for someone who wasn't used to it and knew only vaguely what to do. So that was a good test. For the current job, I wasn't fortunately asked to do any tests - I was nervous as hell as it was.
Oh, and ten points for the first one who can tell me answer for the puzzle without googling it.
Posted by kolibri at 9 November 21:06, 2005Oh, that's easy! You need only two moves:
1) Take 3 balls on both two scale cups. If the scale is even, the heavy one is one of the three left behind. Otherwise, it is one of those three in the heavier cup.
2) Continue with the triple you found using the same principle.
# 2 - Jaana-Mari (on November 10, 2005 02:07 AM):
Iīd be so lost, this answer would never pop up in my mind, yet it is truly logical. Mr Spock, I am ashamed. Oh, no, thatīs an emotion, I mean...my logic is limited in such situations.
# 3 - Outi (on November 10, 2005 02:32 AM):
I don't think I could've figured it out just like that if it wasn't for the fact that I was already familiar with the puzzle :D
# 4 - Henri (on November 10, 2005 06:53 AM):
The question actually doesn't specify the maximum number of scales that can be used. Is putting all balls in separate scales considered one or nine moves?
If each scaling is one action (or you have one scale), then Emokolibri's answer seems to be the correct one, since it takes 2-4 moves. Starting with 2 or 4 balls would mean 5 scalings in the worst case. ;-)
If I'm right, there's also a way to use maximum of 5 scalings by starting with 5 balls.
Actually I realize now, that I immediately thought of a "one cup" digital scale, and not a comparison scale. Am I a nerd or what?
# 5 - Henri (on November 10, 2005 06:58 AM):
A correction: with one cup you need a minimum of 3-4 scalings if you start with 3 balls. If you start with 4 balls, you might get lucky and solve the problem with 2 scalings (although the maximum is still 5).
# 6 - kolibri
(on November 10, 2005 07:00 AM): Hehe, I knew my mom would get it :)
But that's the thing - it's so simple once you know the answer, but if you don't it can be very tricky to figure out. If I would have had to write down how to tackle the problem I would have started with 4 and 4 and 1 balls, using otherwise the same principle - which would have been what the test was after. Why is it so difficult to come up with the idea of dividing the balls into three instead of two?
# 7 - kolibri
(on November 10, 2005 07:08 AM): We are talking about old fashioned scales where you can put something on both cups and and see which one is heavier. Henri is not the only person to start nitpicking on that, though.
The beauty with the three ball solution is that it does indeed guarantee the result in two moves, but always two moves - only better solution would be if you could come up with one that would allow you to get the result with the first one if you're lucky, but would guarantee it on the second (I don't know if one exists). Think about someone cutting off your finger every time you don't get it right - would you start guessing or just go with the guaranteed two moves?
# 8 - Chu (on November 10, 2005 08:19 AM):
I'd have done the same as you, Kolibri: 4 + 4 + 1.
In fact, I was rather pleased with myself, having come up with a solution that made more sense than what would have been my first, intuitive reaction: enter headless chicken mode and start furiously comparing the balls two by two :).
But 3 + 3 + 3, I can't see how that would have occurred to me. I remain - besides greatly amused - firmly in the box, looking inwards, concentrating on the details. That's my forte.
# 9 - Emokolibri (on November 10, 2005 09:54 PM):
For me the number three so natural that it is almost an obsession. World is not black and white; there are yes, no and maybe.
You can't add any more comments, but if you wish you can email the author.

