Find the heavy ball among 27 in three weighings
Asked at Optiver, IMC
You have 27 balls that look identical, but exactly one is slightly heavier than the rest (which all weigh the same). You have a two-pan balance scale that tells you which side is heavier, or that the two sides match.
What is the fewest weighings that guarantees you find the heavy ball, and how?