Find the odd ball among eight balls

You are given eight balls that look exactly the same, and a balance to weigh them against each other. Find the odd ball by weighing only twice?


Problem Statement

The very nice people at the awesome company interview take you to the courtroom where there are eight basketballs that look exactly identical. There's a balance there (a balance is an analog scale that tells you if two objects weight the same. See Lady Justice .)

One of the balls is odd in that it's filled with a slightly heavier gas than regular air.

Getting to an actual interview depends on passing this screening test, in which they've asked you to find the odd ball without using the balance more than twice.

Go!


Evaluation

Get it right without hints (100%)


Solution


Hint 1

If the question seems wrong, it's often because your solution is wrong.


Hint 2

How often have I said to you that when you have eliminated the impossible, whatever remains, however improbable, must be the truth?
Sherlock Holmes


Hint 3

What if there were 6 balls?


References

Microsoft recruiter screening question back in the old days

Amin A.

Written by

Amin Ariana

A software entrepreneur from San Francisco