#501 - Thoughtworks Interview Logic Puzzle
There are ten boxes containing some balls. Each of the ball weighs exactly 10 grams. One of those boxes have defective balls (all the defective balls weigh 9 grams each).
An electronic weighing machine is provided to you and you are allowed only one chance of weighing on it.
How will you find out which box has defective balls ?
Let us simplify boxes by naming them from 1 to 10.
Now the trick here is to pick different number of balls from different boxes. So to simplify things, we will pick balls corresponding to box number.
Thus, pick 1 ball from Box 1, 2 balls from box 2, 3 balls from box 3 and so on. You will have 55 balls altogether. Now, put them all in the balance.
If all balls were weighing accurate 10 grams, the total weight of the 55 balls would have been 550 grams. But one of the box must have had the defective balls.
Suppose if the defective balls were in box number 2, then the total weight will be 2 grams less than 550. If the defective balls were in box 8, the total weight will be less than 8 grams from 550. In this way, you will be able to identify which box has the defective balls.