🍬
Sweet Shop
Week 48
Your younger brother has a collection of coins/notes and asks you what he can buy in the shop spending an amount that exactly equals a value he can make from the money in his pocket
In the shop, you try to work out what he can buy, but struggle, with so many items to possibly buy and too many coin/note combinations to keep track of in your head
When you get home, you decide to create a program to do this instead - specifically, you want to know both how many ways you can make a specific value as well as the specific numbers you need to make these values
Suppose we have the following numbers (e.g. coins/notes) [1, 2, 5, 5, 10] - the expected output is shown below:
A few things to note about the output:
- The "Combination Frequencies" table at the top shows an overview of the number of ways to make each value - e.g. "10: 2" means the total monetary value of 10 can be made in 2 different (unique) ways
- The coins/notes required to make each total should be output in ascending order - i.e. 1 + 2 + 5 = 8 is valid, but 5 + 2 + 1 = 8 isn't
- The combinations for each value should be unique - e.g. there are 2 coins of value 5, but you shouldn't have two identical outputs like 1 + 5 = 6 and another 1 + 5 = 6
- The "--- [n] Combinations ---" parts shows all the given ways to make that combination - note the order doesn't matter. For example, you can see there are 2 ways to make a value of 10, but you can output them in either order
For your program, you should test this on the following coin/note values [1, 1, 1, 2, 2, 5, 5, 10, 10, 10, 10, 20, 50, 50, 100, 100, 200]
Hints
Hints will be released at the start of each of the following days - e.g. the start of day 3 is 48 hours after the challenge starts
| Release Day | Hint |
|---|---|
| 2 |