you have 9 identical balls and among them one is defective as it weighs more than the rest you are provided with a physical balance what will be the minimum number of times you should use the physical balance to figure out the defective ball
Answers
Answered by
1
The 9-ball version is this problem is solvable with the same algorithm, so I'll just use that.
The first step is determining which set of three balls contains the heavy one. So choose balls 1,2,3 and balls 4,5,6 and weigh them. If one set is heavier, save those three balls. If neither side is heavier, proceed with balls 7,8,9. The final weighing requires you to weigh two of the three selected balls. If they are the same, the unweighed ball is the heavy one. If they are different, then the heavier of the two is the odd ball.
(Note: This was formerly an interview question at Facebook. We have since stopped asking it due to low signal/noise ratio. Also because something like 90% of tech people have previously heard the question.)
Similar questions