This project shows logic brainteasers and how to solve them with brute force. It’s intended use is not to avoid thinking about brainteasers—they are still fun—but to have little programming exercises to improve one’s skills. In class rooms, there are way too many exercises like ‘remove the n-th element from the list and randomize it’. Although, they help students to practice programming, they are not motivated by it. As a passionate developer, this is the key to becoming a better developer. Fulfilling a task with a programm is like solving a puzzle. Obviously, you enjoy a puzzle much better if you like the motive.

Brainteaser

The following brainteasers are already implemented in Jupyter Notebooks. This allows for better understanding each step in the process.

Probability of picking a red ball

This brinteaser is a about estimating the—somewhat counterintuitive—probability of picking a red ball from a bowl after already having picked a red ball without returning it. One constraint is that of the three balls in the bowl, one is red, one is blue and one is either red or blue (with a 50% probability). This is similar to the Monty Hall problem where the participant has incomplete information.

Finding the heavy ball on a scale

This brainteaser is a ‘classic’ brainteaser where you have a scale and three or nine balls. One ball is heavier and you need to find it by using the scale only once (twice).

Usage

Feel free to use the notebooks for education or any other purpos. Keep in mind that there are often many possible solutions and these solutions can be further improved.