Coin Problem

some of you may have easily solved the pill weighing problem posed here. If so, you are going to love this problem. It is similar but much more difficult.

from my buddy Tom:

Ok, here’s a tough one (i thought). There are no “aha!” tricks – it requires straightforward deductive-reasoning.

You have 12 coins. one of them is counterfeit. All the good coins weigh the same, while the counterfeit one weights either more or less than a good coin. Your task is to find the counterfeit coin using a balance-scale in 3 weighs. Moreover, you want to say whether the coin weighs more or less than is should and, and this is the real kicker, your weighs must be non-adaptive, that is, your choice of what to put on the balance for your second weigh cannot depend on the outcome of the first weigh and your decision about what to weigh for round 3 cannot depend on what happened either your first or second weigh. For example, you can’t say something like “take coin #1 and coin #2 and weigh them. If they balance, then take coins 3,4,5 and weight them against 6,7,8…if 1 and 2 don’t balance, then weigh #1 vs #12…” you have to say something like:

round #1: do this

round #2: do this

round #3: do this

if the results are left tilt, balanced, and left tilt, respectively, then coin #11 is heavier than it should be.

This problem is solvable…it took me about 1-2 hours of working on it to get it. I think even finding the counterfeit using an adaptive solution is tough. Then non-adaptive constraint makes it quite hard and having to find whether it’s heavier and lighter is cruel and unusual riddling 😉

 

2026 Update: Coin Puzzles and Probability in 2026 Interviews

Coin probability puzzles (weighted coins, sequential flipping, expected values) remain foundational in quantitative and data science interviews. They test your ability to set up probability models — a skill that transfers directly to A/B testing, Bayesian inference, and ML evaluation.

Connection to modern ML: The same conditional probability reasoning used in coin puzzles applies directly to:

  • Bayesian spam filters (prior probability of spam × likelihood of this word given spam)
  • A/B test analysis (is this coin fair? same as: is this variant better?)
  • Calibration in ML models (does a model that predicts 70% confidence actually win 70% of the time?)

What interviewers ask in 2026: “You flip a coin until you get heads. What’s the expected number of flips?” (Answer: 2). “A model outputs 0.7 confidence. How many samples do you need to verify it’s actually calibrated at 70%?” Bridging classic probability to ML evaluation is now expected.

Python for expected value verification:

import random

def expected_flips_until_heads(trials=100_000):
    total_flips = 0
    for _ in range(trials):
        flips = 0
        while random.random() >= 0.5:  # Not heads
            flips += 1
        flips += 1  # The final heads flip
        total_flips += flips
    return total_flips / trials

print(f"Expected flips: {expected_flips_until_heads():.2f}")  # ~2.0
Scroll to Top