90 coins

easy

You have 90 coins that look identical. Exactly one of them is counterfeit and has a different weight from the rest - but you do not know whether it is heavier or lighter.

Your only tool is an old-fashioned balance scale, and each weighing costs $100. It tells you which pan is heavier, or that the two are level, and nothing more.

You want to identify the counterfeit coin and discard it, while keeping the worst-case cost as low as possible.

What is your algorithm, and what is the most it can cost you?