Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int change(int amount, vector<int>& coins) {
- vector<int> dp(amount+1);
- dp[0] = 1;
- for(int coin:coins){
- for(int i=1; i<=amount; i++)
- if(i>=coin)
- dp[i] += dp[i-coin];
- }
- return dp[amount];
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement