diff --git a/Python/CoinChangePer.py b/Python/CoinChangePer.py new file mode 100644 index 0000000..90d1aeb --- /dev/null +++ b/Python/CoinChangePer.py @@ -0,0 +1,28 @@ +# DYNAMIC PROGRAMMING [COIN CHANGE PERMUTATION] +# TABULATION + +def permutation(coins , amt): + dp = [0]*(amt+1) + dp[0] =1 + + for i in range(0 , len(dp)): + for j in range(0 , len(coins)): + coin = coins[j] + + if(i - coin>=0): + dp[i] += dp[i-coin] + + return dp[amt] + + + +lst = [] +n = int(input('enter no. of element ')) +for i in range( 0 , n): + ele = int(input()) + lst.append(ele) + +print(lst) +tar = int(input('enter tar: ')) +ans = permutation(lst , tar) +print(ans) \ No newline at end of file