Jelly Beans

You have three jars that are all mislabeled. one contains peanut butter jelly beans, another grape jelly jelly beans, and the third has a mix of both (not necessarily a 50/50 mix, could be a 1/99 mix or a 399/22 mix). how many jelly beans would you have to pull out, and out of which jars, to find out how to fix the labels on the jars?

|     |        |     |          |     |
|jar 1| |jar 2| |jar 3|
| | | | | |
======= ======= =======
p.b. grape p.b./grape

thanks to joel wollman

Solution

You have three jars that are all mislabeled. one contains peanut butter jelly beans, another grape jelly jelly beans, and the third has a mix of both (not necessarily a 50/50 mix, could be a 1/99 mix or a 399/22 mix). how many jelly beans would you have to pull out, and out of which jars, to find out how to fix the labels on the jars?

   |     |                  |     |                 |     |
|jar 1| |jar 2| |jar 3|
| | | | | |
======= ======= =======
p.b. grape p.b./grape

solution: 1 jelly bean from the p.b./grape jar will do the trick.

the trick here is to realize that every jar is mislabeled. therefore you know that the peanut butter jelly bean jar is not the penut butter jelly bean jar, and the same goes for the rest.

you also need to realize that it is the jar labeled p.b./grape, labelled as the mix jar, that is your best hope. if you choose a jelly bean out of there, then you will know whether that jar is peanut butter or grape jelly jelly beans. it can’t be the mix jar because i already said that every jar is mislabeled.

once you know that jar 3 is either peanut butter, or grape jelly, then you know the other jars also. if it is peanut butter, then jar 2 must be mixed because it can’t be grape (as its labelled) and it can’t be peanut butter (that’s jar 3). hence jar 1 is grape.

if jar 3 is grape, then you know jar 1 must be the mix because it can’t be p.b. (as its labelled) and it can’t be grape (that’s jar 3). hence jar 2 is peanut butter.

if you pick jelly beans from jar 1 or jar 2, then you would have to pick out all of the jelly beans before you knew what that jar was. this is because jar 1 and 2 could be the mix, so in order to disprove that they were the mix, you would have to pull out every jelly bean just to make sure (since there could just be one bean of the opposite flavor in there)

2026 Update: Logic Deduction and Labeling Puzzles

Jelly Bean / mislabeled jar puzzles (three jars mislabeled Red, Blue, Mixed — pick minimum jellybeans to correctly relabel all) test deductive logic: because every label is wrong, one draw from the jar labeled “Mixed” tells you its true contents, which cascades to reveal all three labels.

The solution: Draw from the jar labeled “Mixed.” Since all labels are wrong, this jar cannot be mixed — it’s either all Red or all Blue. One draw reveals which. Now the jar that should be labeled with that color must be the other pure color or mixed. Since its current (wrong) label doesn’t match what it is, the remaining deduction follows.

Why “one draw is sufficient” is the key insight: Most candidates say 2 or 3 draws. The trick is that the wrongness constraint eliminates two of three possibilities immediately. This “exploit the constraint to maximum” reasoning pattern appears in:

  • Binary search: each comparison eliminates half the search space
  • Information theory: how many bits do you need to identify the state?
  • Debugging strategies: choose tests that eliminate the most possibilities per attempt

General framework:

def relabel_strategy(label_contents):
    """
    label_contents: dict mapping wrong_label -> actual_content
    Strategy: sample from 'Mixed' label first (since it cannot be mixed).
    Returns minimum number of samples needed.
    """
    # Since all labels are wrong, sampling 'Mixed' resolves everything
    # Cost: exactly 1 sample, then pure logic
    return 1  # Always sufficient when all labels are known to be wrong

Still asked at (2026): Google, McKinsey, Bain (logical reasoning rounds), and companies testing analytical thinking in PM and data science interviews.

Scroll to Top