The Fruit Jar Labeling Puzzle: Three Mislabeled Jars, One Fruit Picked
The fruit jar labeling puzzle is a famous lateral-thinking interview question that appears at quant trading firms (Jane Street, SIG, Optiver), consulting interviews, and FAANG behavioral rounds. The setup: three jars contain apples, oranges, or a mix; all three labels are wrong; you can pick exactly one fruit from one jar to determine the correct labeling. The key insight — labels are all wrong, not “may be wrong” — unlocks the solution. This guide covers the puzzle, the elegant one-pick solution, and the variants that come up.
Problem Statement
You have three jars labeled “Apples,” “Oranges,” and “Apples and Oranges.” Each label is incorrect — you know with certainty that no jar’s label matches its contents. You may reach into one jar, pick one fruit (without looking inside), and observe what fruit you picked. Based on that single observation, correctly label all three jars.
The Solution
Pick from the jar labeled “Apples and Oranges.”
The label is wrong, so this jar does not contain a mix. It must contain either all apples or all oranges. Whichever fruit you pick tells you which.
Suppose you pick an apple. Then this jar is the apples-only jar. Now consider the remaining two jars: one labeled “Apples” (incorrect — so it’s not apples), one labeled “Oranges” (incorrect — so it’s not oranges).
- The jar labeled “Apples” must be the mix or oranges. Since the apples-only jar is identified, this is the mix.
- The jar labeled “Oranges” must be the apples or mix. Since the mix is identified, this is the oranges-only jar.
Wait, that’s contradictory. Let me redo this.
Three jars: contents are apples (A), oranges (O), and mix (M). Labels are A, O, M; all wrong, so:
- Jar labeled A doesn’t contain A — it’s O or M.
- Jar labeled O doesn’t contain O — it’s A or M.
- Jar labeled M doesn’t contain M — it’s A or O.
Pick from the jar labeled M. It’s not M (label is wrong) — so it’s A or O.
Case 1: you pick an apple. The jar labeled M contains only apples. Now:
- Jar labeled A is O or M. Since A is identified, it’s not A — it’s O or M. By elimination of A: it’s O or M.
- Jar labeled O is A or M. A is identified — so this is M.
- Jar labeled A: by process of elimination, it’s O.
Case 2: you pick an orange. The jar labeled M contains only oranges.
- Jar labeled O is A or M. O is identified, so it’s A or M.
- Jar labeled A is O or M. O is identified, so this is M.
- Jar labeled O: by elimination, it’s A.
In both cases, picking from the M-labeled jar uniquely determines all three labels.
Why This Works
The key insight is that the “all labels are wrong” constraint is informative. The mixed-label jar must be a single-fruit jar (apples or oranges); identifying which one constrains the other two jars uniquely (since their labels are also wrong, they can’t be the identified single-fruit content, and one of them must be the mix).
Without the “all wrong” constraint, the puzzle is unsolvable in one pick. The puzzle’s elegance comes from how strict the constraint is: every label is exactly wrong, which is much stronger than “labels may be wrong.”
Why Picking from Other Jars Doesn’t Work
If you pick from the jar labeled “Apples” — which contains either oranges or the mix — the result is:
- Pick an apple: the jar labeled A contains apples or mix. Since A is wrong, it must be the mix. But this only identifies one jar; the other two could still be A and O in either order.
- Pick an orange: the jar contains oranges or mix. Could be either; the answer is ambiguous.
So picking from the “Apples” jar leaves ambiguity. Same for the “Oranges” jar. Only the M-labeled jar’s contents are constrained to a single-fruit jar (since the label is wrong about being mixed), so picking from it gives unambiguous information.
Variations
Two jars, one mislabel
Trivial — given one mislabel, picking from any jar identifies it. Used as a warm-up sometimes.
N jars, all mislabeled, single-pick
For N > 3 with similar “all labels wrong” constraint, the puzzle becomes harder. Sometimes one pick suffices; sometimes more. The general pattern: pick from a jar whose label-content combination is most constrained.
K wrong labels, but you don’t know which
Different problem; harder. Cannot be solved in one pick if you don’t know in advance which labels are wrong.
Three jars, label may or may not be correct
Different problem entirely. With “labels may be correct,” picking one fruit isn’t enough information.
What Interviewers Test
- Recognize the strength of the “all labels wrong” constraint
- Identify which jar has the most-constrained single-pick outcome (the mix-labeled one)
- Walk through the elimination logic correctly
- Communicate the reasoning clearly
If you’ve heard the puzzle before, say so. Interviewers ask follow-ups: “what if there are 4 jars?” or “what if 2 of 3 labels are wrong but you don’t know which?”
Frequently Asked Questions
What’s the expected interview answer?
Pick from the jar labeled “Apples and Oranges.” Walk through both cases (pick an apple → it’s the apples jar; pick an orange → it’s the oranges jar). Show how the remaining two jars’ contents are uniquely determined by elimination using the “all labels wrong” constraint. Strong candidates also explain why picking from the other jars doesn’t yield enough information.
Why does picking from the M-labeled jar work where others don’t?
The M-labeled jar is the most constrained: since the label is wrong, it can’t be a mix, so it must be a single-fruit jar (either apples or oranges). The other two jars could each be one of two things, and a single pick from them doesn’t uniquely identify which. The M-labeled jar’s pick gives a binary outcome that uniquely determines the entire labeling.
What if “all labels wrong” wasn’t given?
Without that constraint, the puzzle is unsolvable in one pick. You’d need at least two picks to discriminate among the possibilities (or even infinite, if any label could be right). The strict constraint is what makes the puzzle solvable.
How does this scale to more jars?
For N jars with all-mislabeled constraint, the puzzle is solvable in one pick when the labels create enough structure. For arbitrary N, it depends on what the labels are; some configurations require more picks. Most interview versions stick to N = 3.
Why is this a quant trading interview classic?
It tests structured reasoning under information constraints — the same skill as inferring market state from limited observations. Strong candidates immediately realize “the constraint is doing real work” and use it; weaker candidates miss that and try brute-force. The puzzle’s binary-outcome nature also maps to trading: every observation should reduce uncertainty as much as possible.
See also: Bridge Crossing Puzzle • Burning Ropes Puzzle • Two Eggs / 80-Floor Building
💡Strategies for Solving This Problem
Classic Knapsack Variant
This is usually the 0/1 knapsack problem disguised with fruits. Common in Amazon and Microsoft interviews. I got a similar problem at Amazon in 2024.
The Problem
You have a jar with capacity C and n types of fruit. Each fruit type has a value and weight. Maximize the total value you can fit in the jar.
Each fruit can be taken once (0/1 knapsack) or unlimited times (unbounded knapsack). Clarify which version!
Why It's Tricky
Greedy doesn't work. Sorting by value-to-weight ratio and taking items in order can miss the optimal solution.
Example:
- Fruit A: value 60, weight 10 (ratio 6)
- Fruit B: value 100, weight 20 (ratio 5)
- Fruit C: value 120, weight 30 (ratio 4)
- Capacity: 50
Greedy takes A and B (160 total). Optimal is B and C (220 total).
Dynamic Programming Solution
dp[i][w] = max value using first i items with weight limit w
For each item, we choose:
- Don't take it:
dp[i-1][w] - Take it:
value[i] + dp[i-1][w - weight[i]]
Take the maximum of these two.
Space Optimization
We only need the previous row of the DP table, so we can use 1D array instead of 2D. But need to iterate backwards to avoid overwriting values we still need.
At Amazon
My problem was about filling a delivery truck with packages. Same structure as knapsack. Started with 2D DP, interviewer asked me to optimize space to O(capacity).
Also asked: "What if items can be taken multiple times?" That's unbounded knapsack - slightly different recurrence.