All Training Resources

Topic: Data Science.

Difficulty: Easy.

Companies who previously asked this: -

Objective: There are 9 balls which weigh the same except for one, which is heavier than the others. What is the minimum number of weighings you should perform to find the ball with higher weight?

### Full Solution

Label the balls as 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Next, we divide the balls into groups of 3: Balls 123, Balls 456, and Balls 789.
we weigh Balls 123 vs. Balls 456.
Since they weigh the same except for one.

In the first scenario, if the combined weight of both group of balls is not equal, then the heavier side has the ball with the higher weight.
Assuming Balls 123 weighs heavier than Balls 456, then we proceed to weigh Ball 1 vs. Ball 2.
If they weigh the same, then Ball 3 is the heavier ball, but if they do not weigh the same, the heavier ball between Ball 1 or Ball 2 is the heaviest.

In another scenario, if the combined weight of both group of balls is equal after weighing, then it is certain the unweighed Balls 789 has the ball with the higher weight.
Then we proceed to weigh Ball 7 vs. Ball 8.
If they weigh the same, then Ball 9 is the heavier ball, but if they do not weigh the same, the heavier ball between Ball 7 or Ball 8 is the heaviest.

Therefore, we will perform a minimum of 2 weighings to get the ball with the higher weight.