Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int change(int M, int[] A) {
- //dp(x) is to make total x how many possible way
- int[] dp = new int[M+1];
- dp[0] = 1;
- for(int c = 0 ; c < A.length; ++c){
- for(int i = A[c]; i < M+1; ++i){
- dp[i] += dp[i-A[c]];
- }
- }
- return dp[M];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement