Problem: find the amount of different amounts of money a stack of coins can make.
The vector, coins, contains the values of the coins, and the corresponding vector, amount, contains the number of coins that there are (let's say coins = {1}
Y amount = {5}
, this means I have 5 cents).
Although I have solved this problem, I would like to make it more efficient. Could someone give me some advice?
Miscellaneous information: the variable ctq
it means "coins to quantity". I solved this by systematically iterating all possible combinations of coins and putting their sum in a set. There has to be a better way to solve this problem, since this is supposed to be a dynamic programming problem and I solved this problem without any knowledge of what it is supposed to be.
#include
#include
#include