pickzy.com

C  |  C++  |  Objective-C  |  VC++  |  Win32  |  MFC  |  Java  |  Php  |  Delphi  |  Visual Basic  |  .Net  |  Networking  |  General  |  Games  |  Jobs  |  Javascript  |  




Menu

pickSourcecode.com


        

 




 

Cpp > Solution

 

Cpp - Apple orange and mixed fruit puzzle

Puzzle #4
You have three baskets. One only contains apples. One only contains oranges. And the last one is an 

even mix of apples and oranges. The three boxes are labeled. But all labels are placed incorrectly. 

Your job is to fix the three labels. You can reach in any basket, take one fruit out, examine it, 

and put it back. There is no other way to examine or look at the baskets. You want to minimize the number

 of fruits that you take out to examine. What do you do? 



Ans:


Pick up a fruit from the box marked as mix of apples and oranges. If it is orange, mark it as orange.

The one marked as orange becomes apple and the one marked as apple becomes mixed fruit box.

 
Privacy Policy | About Us