A classic job interview question goes like this:
You're given 12 balls which all look the same.
However, one of the balls weights differently (either lighter or heavier).
Your task is to identify which ball is different and to tell whether it's heavier or lighter.
The only tool you've got is a balance scale, which you can use up to 3 times.
Only balls can be put on the scale cups.
This is an implementation of a brute force solution of the above problem. It supports arbitrary number of balls and number of measurements.
Wiki entry on the problem: https://en.wikipedia.org/wiki/Balance_puzzle