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.
l=len(c)
ways=[[0 for p in range(n+1) ] for m in range(l)]
for p in range(0,l):
ways[p][0]=1
for p in range(0,n+1,c[0]):
#print(p)
ways[0][p] = 1
for i in range(1,l):
for j in range(1,n+1):
p=j-c[i]
if p <0:
x=0
else:
x=ways[i][p]
y=ways[i-1][j]
ways[i][j]= x+y
print(long(ways[l-1][n]))
i m getting expected output still test case not passing
The Coin Change Problem
You are viewing a single comment's thread. Return to all comments →
def getWays(n, c):
i m getting expected output still test case not passing
for example
input:
10 4
2 5 3 6
expected output: 5
debug output : 5
still test case fails
plzz help