Apples and Oranges

Question:

You have 3 baskets, one with apples, one with oranges and one with both apples and oranges mixed. Each basket is closed and is labeled with ‘Apples’, ‘Oranges’ and ‘Apples and Oranges’. However, each of these labels is always placed incorrectly. How would you pick only one fruit from a basket to place the labels correctly on all the baskets?

.

.

C

A

P

T

A

I

N

I

N

T

E

R

V

I

E

W

.

.

Solution: These kinds of questions make for a good warm up in an interview. Frankly speaking, this puzzle just needs a little thought. It really doesn’t take any algorithmic genius.

Say you pick a fruit from the basket labeled ‘Apples and Oranges’. If this fruit is an apple, then we know that since the label is incorrect, this basket only contains apples. Now that we’ve determined that the basket marked as ‘Apples and Oranges’ only contains apples, we can figure out what the other baskets contain. If we look at the basket labeled as ‘Oranges’, we know that since the label is incorrect, this basket either has only apples in it or has both apples and oranges. Since we’ve already established that the basket labeled ‘Apples and Oranges’ contains only apples, we know that the basket labeled as ‘Oranges’ contains both apples and oranges. Then by simple process of elimination, we know that the basket labeled as ‘Apples’ contains only oranges.

You can apply the same logic if you assume you picked an orange from the basket labeled as ‘Apples and Oranges’.

If you have any questions, please feel free to send us a message on our Facebook page. If you have any interview questions which you feel would benefit others, We would love to hear about it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s