Question: box of defective balls puzzle or logical interview question
- You are given 10 boxes containing balls.
- The 9 boxes contains the balls, each ball weighing 10 gm
- The 1 box (defective box) contains the balls, each ball weighing 9 gm.
- You are given electronic weighing machine and you can use the weighing machine only once.
- Find out the defective box among 10 boxes (box containing balls of 9 gm weigh)
Solution: box of defective balls puzzle or logical interview question
- Suppose boxes are labelled from 1 to 10.
- Take 1 balls from box 1, 2 balls from box 2, 3 balls from box 3 and so on. At last take 10 balls from box 10.
- Sum(n) = n(n+1) / 2
- Total numbers of balls = (10 * 11)/ 2 = 55
- If all 10 boxes had contained 10 gm balls, Total weight would be:
- Total weight = 55 * 10 gm = 550 gm
- But, We have a box which contains 9 gm balls.
- We will not get sum of 550.
- Our sum will be reduced.
- Depending upon, how many defective balls ,we have picked (Step 2).
- If Sum, we get due to defective box is 549, which is 1 less than possible sum of 550.
- It mean we have 1 defective ball
- We have picked 1 ball from box number 1.
- Then box number 1 is defective box.
- If Sum is 548, which is 2 less than possible sum of 550.
- It mean we have 2 defective balls
- We have picked 2 ball from box number 2
- Then box number 2 is defective box.
- Similarly, if Sum is 540, which is 10 less than possible sum of 550.
- We have picked 10 ball from box number 10
- Then box number 10 is defective box.
- We can identified the defective box among 10 boxes.