# The Fruit-Jar Problem

You have been provided with 6 closed jars, each containing fruits, and each labelled differently and incorrectly. The jars are closed and you cannot look into them. But you can take out fruits out of them, one at a time. Jars are labelled as:

• Apples
• Oranges
• Mango
• Apples and Oranges
• Oranges and Mango
• Mango and Apples

What will be the minimum number of fruits you need to pick from each "incorrectly labelled" jar to label all of them correctly?

• Maybe I'm too sleepy to think straight but... isn't that impossible to do? If you are unlucky and only pull apples out of the "apples and oranges" jar, how would you ever differentiate it from the normal apple jar?.... Granted I am very sleepy right now... but oh well. Commented Dec 8, 2016 at 15:05
• @stackreader... I did not mentioned that we will have a finite minimum set? did I? Commented Dec 8, 2016 at 15:09

There is no set minimum.

If the boxes labeled "oranges", "mangoes", and "oranges and mangoes" contain apples, apples & oranges, and apples & mangoes, but when you draw from those three boxes you happen to only draw apples, you cannot determine which box is which.

The worst case scenario is that you'd need to empty one box entirely to determine it only contains apples and another box you'd need to pull out all the apples to determine which other type of fruit it contains.

• was expecting a quick answer :) Commented Dec 8, 2016 at 15:13

Interpreting the question as flu does: "What is the minimum number of fruit you need to draw (if you're lucky) where it could be possible to determine which all the jars are?"

The answer to that question is

5

Here's how:

Draw one fruit from each of the jars that says "mango" anywhere on its label, and they all just happen to be mangoes. Thus these three jars must be mixed with each other and the other three mixed among themselves. Draw one fruit from the jar labeled just "mangoes", and get an orange. Now you know: "Mangoes" contains mangoes & oranges. "Mangoes & Apples" must be mislabeled, so it must contain just "Mangoes", and "Mangoes & Oranges" must contain mangoes & apples.

Next

Draw one fruit from the box labeled "Apples & Oranges", getting an apple. That box must be labeled wrong, so it must be just apples, while "Oranges" must contain apples & oranges, and "Apples" must contain oranges.

Thus

Total: 5 fruit: 3 mangoes and an apple and an orange.

The question states what is the minimum number of fruits you need to pick from each jar to label all of them correctly. My interpretation is that you could get very lucky and not have to resort to taking every piece out.

With that in mind, here's my possibly naïve solution, where you simply get incredibly lucky. Therefore this is the minimum number of pieces you need to take out of each jar.

"Apples" Jar: You take out two pieces: 1) apple and 2) mango.
"Oranges" Jar: You take out two pieces: 1) orange and 2) apple.
"Mango" Jar: You take out two pieces: 1) mango and 2) orange.
"Apples and Oranges" Jar: You take out one piece: 1) apple.
"Oranges and Mango" Jar: You take out one piece: 1) orange.

Thus, with 8 pieces taken out (2, 2, 2, 1, 1), you can deduce that:
"Apples" should be labeled "Mango and Apples"
"Oranges" should be labeled "Apples and Oranges"
"Mango" should be labeled "Oranges and Mango"
"Apples and Oranges" should be labeled "Apples"
"Oranges and Mango" should be labeled "Oranges"
"Mangos and Apple" should be labeled "Mango"

• Interesting interpretation on the question wording. But with good luck, you can determine all the jars by drawing as few as 5 fruit. Commented Dec 8, 2016 at 19:36
• @user3294068 You're right, it can be better. I see a solution with 6 fruit, but not with 5. Mind explaining?
– flu
Commented Dec 8, 2016 at 20:17