Interview Question

Software Engineer Interview Boston, MA

Given the use of a weighing scale twice, identify which of

  eight coins is the heavier one.
Answer

Interview Answer

1 Answer

1

For 8 coins and two weighing
1. Put 3 coins on each side of the scale. Now you have three sets of coins.
2. If the scale becomes unbalanced, then the heaviest is on the lower side. Else, if the scale remains balanced, then the heaviest is in the set not on the scale.
3 Using which ever set (of 3 coins) contains the heaviest, put one coin on each side of the scale.
4. If the scale becomes unbalanced, then the heaviest is on the lower side. Else, if the scale remains balanced, then the heaviest is the one not on the scale.

Sounds kind of like recursion.

Anonymous on Apr 18, 2013

Add Answers or Comments

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