Dynamic Programming - making change

后端 未结 4 1955
陌清茗
陌清茗 2020-12-11 05:08

I\'m having trouble figuring out my last section of code for a Dynamic Coin Changing Problem. I have included the code below.

I can\'t figure out the last else

4条回答
  •  忘掉有多难
    2020-12-11 05:58

    Are you over thinking this? If we were trying to give 68 cents change using U.S. coins…

    Would ‘denom’ be { 25, 10, 5, 1 } ?

    And wouldn’t the answer be “2 quarters, 1 dime, 1 nickel, and 3 pennies” = ‘2 + 1 + 1 + 3 = 7’? So the function should return the value 7. Right?

提交回复
热议问题