Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int coinSum(List<int> coins, int total)
- {
- var dp = new int[total + 1];
- dp[0] = 1;
- for(int i = 0; i < coins.Count; i++)
- for(int coin = coins[i]; coin < total + 1; coin++)
- dp[coin] += dp[coin - coins[i]];
- return dp[total];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement