Given an integer array containing the available denominations of coins in descending order, write a method to compute the number of possible ways of representing a monetary

For simplicity, assume that there are an infinite number of coins available for each coin denomination in the array.

Examples:

`amount`

in cents. For simplicity, assume that there are an infinite number of coins available for each coin denomination in the array.

Examples:

`makeChange({25,10,5,1},10) ==> 4`

Need a **hand?** Try out these hints, one at a time.

Break the larger problem into smaller ones. For example, to get 10 cents, we could either use the largest coin feasible (10 cents), or use

the next largest coin (5 cents).

the next largest coin (5 cents).

Use each different coin denomination and sum them multiple times to add up to the amount.

1. Declare a variable to keep track of the next coin denomination index.

2. If the current coin denomination index is equal to the last coin index, return that denomiation itself

3. Else update the

4. Start a loop -

5. Return the sum stored in the temporary variable at the end of the loop.

1. Declare a variable to keep track of the next coin denomination index.

2. If the current coin denomination index is equal to the last coin index, return that denomiation itself

3. Else update the

`next_coin_index`

to `current_coin_index + 1`

4. Start a loop -

`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.5. Return the sum stored in the temporary variable at the end of the loop.

public static int makeChange(int[] coins, int amount) { }

**C**

**Java**

**Python**