Interview Question

Software Development Engineer In Test (SDET) Interview

You have 9 marbles and one is slightly heavier than the

  rest. You also have a scale. How would you determine the heavier marble using the scale only twice?
Answer

Interview Answer

1 Answer

3

The first time you use a scale, put three marbles on each side of the scale.

If the scale balances after the first time, put one of the remaining three marbles of each side of the scale; if the scale balances after this, the heaviest marble is the remaining one, otherwise it is the one on the heaviest side of the scale.

If the scale does not balance after the first time, put the marbles from the heaviest side in a pile, and from this pile, put one marble on each side of the scale. If the scale balances after this, the heaviest marble is the remaining one, otherwise it is the one on the heaviest side of the scale.

Boris on Feb 27, 2013

Add Answers or Comments

To comment on this question, Sign In with Facebook or Sign Up