Solution: Make Your own Change Machine
Solution: The greedy way
The simple greedy idea is to start from the largest possible coin available (in our case, it is a , or ) and to keep adding coins while the remaining value is greater than .
This is not the most optimized solution. It is only to give you an idea of how the greedy algorithm works. If you want to look at the most optimized version have a look at it in the (previous) Dynamic Programming section.