We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defgetWays(n,c):# Write your code herec.sort()dp=[[0for_inrange(n+1)]foriinrange(len(c)+1)]foriinrange(1,len(c)+1):forjinrange(1,n+1):ifc[i-1]<j:forkinrange(i,0,-1):dp[i][j]+=dp[k][j-c[i-1]]elifc[i-1]==j:dp[i][j]=1else:dp[i][j]=0result=[dp[i][-1]foriinrange(1,len(dp))]returnsum(result)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Coin Change Problem
You are viewing a single comment's thread. Return to all comments →
This is not much. But an honest work