3 Mislabeled Jars

Puzzle:

This problem is also called Jelly Beans problem. This is the most commonly asked interview puzzle.

You have 3 jars that are all mislabeled. One jar contains Apple, another contains Oranges and the third jar contains a mixture of both Apple and Oranges.

You are allowed to pick as many fruits as you want from each jar to fix the labels on the jars. What is the minimum number of fruits that you have to pick and from which jars to correctly label them?

Labels on jars are as follows:

3 mislabeled jars of Apple and Orange


Puzzle Solution:

Let’s take a scenario. Suppose you pick from jar labelled as Apple and Oranges and you got Apple from it. That means that jar should be Apple as it is incorrectly labelled. So it has to be Apple jar.
Now the jar labelled Oranges has to be Mixed as it cannot be the Oranges jar as they are wrongly labelled and the jar labelled Apple has to be Oranges.

Similar scenario applies if it’s a Oranges taken out from the jar labelled as Apple and Oranges. So you need to pick just one fruit from the jar labelled as Apple and Oranges to correctly label the jars.

8 Thoughts on “3 Mislabeled Jars

  1. napender on July 2, 2015 at 8:25 am said:

    We know that every jar has wrong label on it, now we know that “apple and orange” label jar is either apple or orange, so we will pick one fruit let suppose this fruit is an apple so the label of this jar should be “apple”, so now “apple and orange” jar is now —–> “apple” jar
    then jar which labeled orange is “apple and orange” because we know that this jar has wrong label and we have already find the “apple” jar. so now orange jar is “apple and orange” jar and obviously “apple” jar is “apple and orange” jar.

  2. Jayanth on July 25, 2015 at 3:42 pm said:

    The key is in picking first from the jar that is labelled “Apple & Oranges”. If you pick first from any of the other 2 jars, it will lead to confusion.

  3. Leslie on March 1, 2016 at 8:29 am said:

    Who is the mathematician who came up with the 3 mislabeled jar problem?

  4. Akshay on July 30, 2016 at 2:19 pm said:

    What if we don’t know how if jars are mislabeled or not? Then how many fruits will it take to label it correctly?

  5. Deepak Goutam on October 22, 2017 at 9:57 am said:

    Zero . Just thing about it all jars are mislabeled so select jar with Apple+orange label rest of the two jar mislabeled as (orange->Apple or Apple->Orange) but out of two one must contains either apple or orange so interchange both the labels now one must have right labeled now inter change rest of the two label. By this way you no need to pick even a single fruit from jars.

    • Kalyan Venkat Miriyala on March 21, 2019 at 11:20 pm said:

      but out of two one must contains either apple or orange so interchange both the labels now one must have right labeled now…. How you’ll know that one ?

  6. Goutham Vijapur on March 2, 2020 at 2:01 am said:

    Jar with Apples: Label as A
    Jar with Oranges: Label as O
    Jar with Apples & Oranges: Label as M

    Labels provided: A, M, O
    (But incorrectly labelled)

    Correct labelling (Option 1): A->O, M-> A, O-> M

    Correct labelling (Option 2): A->M, M->O, O->A

    In general, it’s a circular misplacement of names on the jars.

    So by picking a single fruit from the jar originally labelled as M, we can find the correct labels of all the 3 jars.

  7. Govind kumar on April 25, 2020 at 10:45 pm said:

    One fruits have to be picked to correctly label them.
    1. we know that all label contains different fruits means mixture label jar doesn’t contains Mixture of fruits .
    2. First we will choose fruits from the mixer jar. Suppose this turned out to be Apple. So we’ll label it as Apple Jar.
    3. Orange label jar doesn’t contain orange
    3. means it contains either mixture of fruits or apple. apple jar we have identified already so it will be mixture jar and 3rd one will be the orange jar.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation