There are 3 baskets labeled ‘Apples’, ‘Oranges’ & ‘Mixture’. One of them contains only Apples, one only Oranges and one has mix of apples and oranges both.
These baskets are not labeled correctly. In fact, the labels on these baskets always lie. (i.e. if the label says Oranges, Then you are sure the basket either has only Apples or Mixture).
You are allowed to pick one fruit from one basket (Not allowed to see other fruits), and you have to put all the labels correctly on the basis of that information (by seeing only one fruit from any one basket).
How will you do that ?
Pick a fruit from the basket labeled ‘Mixture’. We know from the question that this basket does not contain ‘Mixture’ for sure.
You can apply the same logic if you assume you initially picked an orange from the basket labeled as ‘Mixture’.
4 Comments
To see the java source code of puzzle, visit: https://github.com/SanjayMadnani/com.opteamix.microthon
code is taking the input by console only. You can fork or clone the repository and proceed further. You can also rise bug if you find any.
Run BasketPuzzleGameTest.java class as a Junit test case to start game.
wAssuppa
ed
put the apples and oranges in s_p_r_t_ in basket