What is a good algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, but the algorithm needs to work for the generic case where the bill set can differ over time (due to running out of a bill) or due to bill denominations differing by currency. The problem would apply to a foreign exchange teller at an airport.
So $50 can be met with a set of ($20 and $30), but cannot be met with a set of ($20 and $40).
In addition. If the amount cannot be met with the bill denominations available how do you determine the closest amounts above and below which can be met?