To learn c++ I’ve been relying on forums to get through. I usually hate having to trawl through it all, but today I stumbled across a treasure trove of CS riddles. Fun fun!
The Jam Jar puzzle (Level 1):
You are on a foreign island and the locals will let you live if you win their game. They give you two jars, one with 50 white marbles, the other with 50 black marbles. At first you can rearrange them as you wish. Then you are blindfolded, the jars shaken, and one randomly given to you. You have to pick a white marble to survive!
How do you rearrange the marbles so you have the highest probability of choosing a white marble?