Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
Monday, July 2, 2012
Solve the coin change problem
def count( n, m ):
if n == 0:
return 1
if n < 0:
return 0
if m <= 0 and n >= 1: #m < 0 for zero indexed programming languages
return 0
return count( n, m - 1 ) + count( n - S[m], m )
No comments:
Post a Comment