Hi, there, just so you know this is a classic DP problem, the Change-making problem. You can find the solution for unlimited coins in the YT (YouTube), for the limited case, I recommend taking the most coins possible for each value. And you will need a prune strategy, since the amount of change grow until the maximum of coins available. I've used twice the smallest value for my AC code.