That was my approach too.   The trick is to realise that you don't get 2 
useful outcomes from weighing two things in this puzzle but 3:  Left is 
heavier, Right is heavier, or both are equal.

All three outcomes can be used to deduce the next step, which is why you 
don't need to weigh all balls first.  If you leave out two and weight 3 each 
side, and the first weighing produces equal weights then one of the two 
excluded must be the heavy one.

I am reckoning 3 choices squared can sort between 8 balls, whereas 2 squared 
could not.

Other questions at:

http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html

> Hi John,
>
> I'll take a shot at being clever - just 'cos I've come out of a 2.5 hour 
> meeting on a Friday afternoon in early January :D
>
> First weigh two sets of three balls.  If they balance then it's one of the 
> other two balls and you can use the second weighing to determine which. 
> If the two sets of three don't balance, then take any two balls from the 
> heavier set of three and use your second weighing for those.  If they 
> balance, then the unweighed ball is the heavier.  Otherwise, it's the one 
> that weighed heaviest in that second weighing.
>
> Regards,
>
> Bevan
>
>
>
> On Fri 08/01/10 12:48 PM , "John Bird" [email protected] sent:
>> One of the famous Google interview  questions
>>
>> 12. You Have Eight Balls All Of The Same Size. Seven Of Them Weigh
>> The Same,  And One Of Them Weighs Slightly More. How Can You Find The
>> Ball That Is Heavier  By Using A Balance And Only Two Weighings?
>>
>> Post answers here. [I figured one way - maybe there are  more.  Your
>> prize is smug satisfaction at being clever]   John
>>
>
> _______________________________________________
> NZ Borland Developers Group Offtopic mailing list
> Post: [email protected]
> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
> Unsubscribe: send an email to [email protected] with 
> Subject: unsubscribe 


_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to