Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

12 Balls, 1 slightly heavier

Name: Anonymous 2009-10-01 16:22

I got asked this question at least in 3 different job interviews!  What's the point?  What are they "looking" for?

At least the next 2 times, I already had the answer and just spewed it out.

The question:

You have 12 identical balls but one slightly heavier.  You also have a balance scale.  How would you isolate the slightly heavier ball using the balance scale as little as possible?

Answer:

Divide the balls into 2 groups of 6.  Use the balance scale to find the slightly heavier group and discard the lighter one.  Then divide the remaining 6 into 2 groups of 3 and weight on the scale.  Discard the lighter 3 balls.  Now take 2 of the remaining 3 balls and compare them on the scale.  If they weight the same, then the left over one is heavier.  If there's a difference, then take the heavier one on the scale.

Name: Anonymous 2009-10-01 23:47

That you are clever and have learning that can be demonstrated in testing format. It is overused and thus useless but what are you going to do.

Hmm. Your solution implies you could solve the same problem for 10-27 balls just as easily. One wonders why they asked about 12 balls.

Name: 4tran 2009-10-01 23:51

>>1, 2
The much harder question is if you don't know the odd ball is lighter or heavier.

Name: Anonymous 2009-10-02 3:04

Wait. OP, are you saying you COULDN'T figure it out for the first one? Fuckken LOL.

Name: Anonymous 2009-10-02 23:52

>>1
They are trying to see if you've been to a job interview before.

Name: Anonymous 2009-10-03 3:09

They get off on people talking about balls.

Name: Anonymous 2009-10-03 17:26

>>5
This.

Name: Anonymous 2009-10-03 20:28

I've actually seen this in a job interview:

How do you put a giraffe into the refrigerator?
Correct answer: Open the refrigerator door, put the giraffe in, and close the door. This question tests whether or not the candidate is doing simple things in a complicated way.

How do you put an elephant in the refrigerator?
Incorrect answer: Open the refrigerator door, put in the elephant, and close the door. Correct answer: Open the refrigerator door, take out the giraffe, put in the elephant, and close the door. This question tests your foresight.

The Lion King is hosting an animal conference. All the animals in the world attend except one. Which animal does not attend?
Correct answer: The elephant. The elephant is in the refrigerator, remember? This tests if you are capable of comprehensive thinking.

There is a river notoriously known for it’s large crocodile population. With ease, how do you safely cross it?
Correct answer: Simply swim across. All of the crocodiles are attending the Lion King’s animal conference. This questions your reasoning ability.

Name: Anonymous 2009-10-03 22:19

>>3
Not really. You simply do a binary search. 12 balls is four weighings, 32 balls is 4 weighings.

Try this one: all the balls weigh slightly differently, but the combined weight of any two balls are heavier than any other ball. What is the least number of weighings needed to sort, say, 20 of them?

Name: Anonymous 2009-10-03 22:30

>>9
To be clear, any n balls are heaver than any n-1 balls. Also, different situations lead to different numbers of weighings, so worst-case it.

Name: Anonymous 2009-10-03 23:10

op, there are other ways to solve these problems, you're doing it the obvious way, maybe they're looking at that...

for example if you have 9 balls and you know one is heavier than the rest, you can determine which one it is using the scale only 2 times. whereas the obvious solution would require 3 uses of the scale.

Name: Anonymous 2009-10-03 23:32

also, for the 12 ball case, here's a nice way to do it that gives you a 50% chance of only having to use the scale twice, and 50% chance of having to use it 3 times

1. separate the 12 balls into 4 groups of three balls each
2. weigh group 1 against group 2
3a. if scale unbalanced, take two balls from the heavier group and weigh them against each other to figure out which is the heavy ball in the group
3b. if scale is balanced, weigh group 3 and 4, take two balls from the heavier group and weigh again...

if the heavy ball ends up in group 1 or 2, you only need to use the scale twice, otherwise you use it 3 times.

Name: Anonymous 2009-10-04 6:22

>>8
this is the worst bs i've ever heard.

Name: 4tran 2009-10-04 7:06

>>9
yes, the standard trick is to use a binary search
However, I have heard it claimed that (with 12 balls total) you can find the odd ball out using only 3 weighings, if you don't know the odd ball is heavier/lighter.  I heard this a long time ago, and haven't put enough thought into it.  It's probably not as hard as I'm making it out to be.  The puzzle you suggested is interesting.

Name: Anonymous 2009-10-04 15:20

>>14
Separate into two groups of six. Weigh.
Take heavier group, and separate into two groups of three. Weigh.
Take two of the three that come out heavier and weigh. Then you know it's one of those two or the remaining one if the scales balance.

Name: 4tran 2009-10-04 18:35

>>15
Yes, I've thought of that, and it's basically what was suggested above.  However, I was having difficulty with the slightly different problem of not knowing whether the odd ball is lighter or heavier.  Your solution only works 50%.  If it was lighter (which you can only tell at the 2nd weighing), then your solution would require 4 weighings.

Name: Anonymous 2009-10-04 21:35

You should always be dividing your balls into three groups to efficiently use each of the three possible outcomes of each weighing.

Name: Anonymous 2009-10-05 10:40

>>14
However, I have heard it claimed that (with 12 balls total) you can find the odd ball out using only 3 weighings, if you don't know the odd ball is heavier/lighter.
It is possible, but not easy (it took me an exhaustive search to find the method).

Name: Anonymous 2009-10-06 12:44

make three groups(a,b,c) containing four balls each
weigh group a and b, if they're equal take group c

then weigh c[0] and c[1]
then weigh c[1] and c[2]

if both weighs are equal then c[3] is the oddball, if the first one if unequal and the second is equal, it is c[0], if both are unequal, it is c[1] if the first is equal and the second is not take c[2].

else if a and b are unequal
we take the lighter group and call it l
we take the heavier group and call it h

take l[0],h[0],c[0] weighed against l[1],l[2],h[1]

if the scales are equal then
we weigh h[2] and h[3] if they're equal then l[3] was the culprit. Otherwise the lighter of the two was bad.

if the scales tipped toward l[0],h[0],c[0] then we weigh h[1] v c[0] if it is heavier than h[1] is the oddball, otherwise l[1] is.

if the scale tipped toward l[1],l[2],h[1], we weigh l[1] and l[2] and the oddball is whichever is lighter.

I hope that makes sense.

Name: Anonymous 2009-10-06 17:07

>>19
Thank you so much! I finally got that damn ball!
In case anyone's wondering, it turned out to be ball number six, and it's a fair bit heavier. I think I'll just sand it down a bit and hope nobody notices.

Name: Anonymous 2009-10-07 2:44

put the scale aside.
weigh balls wit your hands

Name: Anonymous 2009-10-07 12:30

one of my balls is slightly heavier than the other

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List