Coin change problem with infinite number of coins of each denomination

后端 未结 5 720
感动是毒
感动是毒 2020-12-09 07:19

I want to know the idea of algorithm for the coin change problem where each denomination has infinte number of coins. Means how to apply DP (like the standard coin change pr

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 07:34

    You can run it here http://www.exorithm.com/algorithm/view/coin_change

    function coin_change ($amount, $coins)
    {
      $change = array();
      rsort($coins);
      for($i=0; $i

提交回复
热议问题