Here's a solution to problem #5, found here:
Write a program that outputs all possibilities to put + or - or nothing between the numbers 1, 2, ..., 9 (in this order) such that the result is always 100. For example: 1 + 2 + 34 โ 5 + 67 โ 8 + 9 = 100.
I found 11.
I went about it using:
- TDD
- recursion
- starting with a smaller version of the problem.
Take a look at
- the git history to see how it progressed (my design changed a lot at the beginning, and continued to change throughout)
- the tests to see how to use it and what it can do.