An old chestnut goes like this:

You are applying for the position of the King's treasurer. As a test, the King has presented you with twelve gold coins and a balance (a scale which tells you only whether two things weigh the same, or which one weighs more). One of the coins weighs slightly more or less than the others, but not by enough to determine it other than using the balance. Find it in three weighings, and determine whether it is heavy or light.

How can you arrange this to guarantee you can find the coin within three weighings?

You succeed in doing so, but you are not the only applicant to do so, so the King presents you with a second test. This time, you have a new set of 13 coins, one of which is heavy or light, but not necessarily the same way as before, and the King also supplies you with one of the good coins from the first test, which weighs the same as the good coins in this test. How do you find the bad coin in three weighings and again determine whether it is heavy or light?