amount
in cents. makeChange({25,10,5,1},10) ==> 4
next_coin_index
to current_coin_index + 1
counter * coins[current_coin_index]
<= amount
, and sum up the recursive call makeChange(coins,amount-i
*
coins[current_coin_index],
next_coin_index)
. Store it in a temporary variable.public static int makeChange(int[] coins, int amount) { }
C
Java
Python