Related Articles

# Puzzle | The Pot of Beans

• Difficulty Level : Hard
• Last Updated : 07 Feb, 2018

A pot contains 75 white beans and 150 black ones. Next to the pot is a large pile of black beans. A somewhat demented cook removes the beans from the pot, one at a time, according to the following strange rule:
He removes two beans from the pot at random. If atleast one of the beans is black, he places it on the bean pile and drops the other bean, no matter what color, back in the pot.
If both beans are white, on the other hand, he discards both of them and removes one black bean from the pile and drops it in the pot.
At each turn of this procedure, the pot has one less bean in it. Eventually, just one bean is left in the pot. What color is it?
Solution :-
White
The cook removes the white beans two at a time, and there is an odd number of them. When the cook gets to the last white bean and picks it up along with a black bean, the white one always goes back into the pot.

References:-
Slideshare

This article is contributed by Roshni Agarwal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.