Untitled
unknown
c_cpp
a year ago
338 B
6
Indexable
int change(int amount, vector<int>& coins) {
vector<unsigned int> dp(amount+1);
dp[0] = 1;
for (int i=1;i<=amount;i++) {
for (int x:coins) {
if (i >= x) {
dp[i] += dp[i-x];
}
}
}
return dp[amount];
}Editor is loading...
Leave a Comment