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