DEV Community

Discussion on: Daily Challenge #108 - Find the Counterfeit Coin

Collapse
 
peledzohar profile image
Zohar Peled

This is a very old question. I remember being asked this question about 25 years ago.

The answer is to divide to three groups, as equal as possible. You have 9 coins. You start by measuring 3 against 3. If one is lighter than the other, that's where the coin is, and you again split to 3 piles of one coin each and measure. If both are the same, the counterfeit coin is the one left out - meaning you only need two weightings to find the counterfeit.