Microsoft Interview Question: I am given eight same size ba... | Glassdoor

Interview Question

Software Development Engineer Interview(Student Candidate)

I am given eight same size balls, one ball has less weight

  than others, how to find the ball in two step.

Interview Answer

2 Answers


Take two random balls out. Then divide the 6 remaining ones into 2 groups, 3 balls in each. Measure those two groups. This is your 1st step. If their weights are equal, that means that the lighter ball is among the two that we took out first. Measure their weights (this will be your 2nd step) and find it.
If the weights of the three-ball groups are not equal, take one random ball out of the lighter group and measure the remaining two balls (this is your second step). If their weights are equal, then the lighter ball is the one that you just took out. Otherwise, the answer is obvious.

Alex on Jun 9, 2013

This is a simplified version of: 12 balls, without knowing the bad ball is heavier or lighter, but in 3 steps.

Peter on Jul 20, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.