Fruit Basket Puzzle – Coding N Concepts | ninjasquad
The Fruit basket puzzle comes under basic puzzles being asked in the interview.
There are 3 baskets. One basket has apples 🍎🍎 only, one has oranges 🍊🍊 only and the other has mixture of apples and oranges 🍎🍊. All the three baskets are wrongly labelled as APPLES, ORANGES and MIXTURE that means if basket is labelled as ORANGES, it is having either mixture or apples. You have to pick only one fruit from any of the one basket and correctly label all the three baskets.
How do you do it?
Think for a while before looking at the solution.
Pick a fruit from the one labeled MIXTURE which have two possible outcomes:-
If that fruit is orange then correct label for this basket is ORANGES. The one which is fake labelled as APPLES must be either ORANGES or MIXTURE. Since we have already found our ORANGES basket. APPLES basket is actually a MIXTURE and the one fake labelled as ORANGES is APPLES.
Fake Label Correct Label MIXTURE ORANGES APPLES MIXTURE ORANGES APPLES
If that fruit is apple then correct label for this basket is APPLES. The one which is fake labelled as ORANGES must be either APPLES or MIXTURE. Since we have already found our APPLES basket. ORANGES basket is actually a MIXTURE and the one fake labelled as APPLES is ORANGES.
Fake Label Correct Label MIXTURE APPLES ORANGES MIXTURE APPLES ORANGES