Skip to content

Commit 35ce59b

Browse files
committed
added comment for understading
1 parent b26a7f8 commit 35ce59b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

CoinChangeSet1.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def foo(n, s):
2222
matrix[row+1][col] = matrix[row][col]
2323
else:
2424
#add the value from top and s[row] steps behind
25+
#why do we move those s[row] steps behind ?
26+
#coz there is a multiple of s[row] those many steps behind and if there isnt then we still get the correct value
2527
matrix[row+1][col] = matrix[row][col]+matrix[row+1][col-s[row]]
2628
print matrix
2729
print "So the total number of ways to make the change is "+str(matrix[len(s)][n])

0 commit comments

Comments
 (0)