### Question:
CoinChangeSolution { public static int countRecursive(int coins[], int c, int sum) { if (sum == 0) return 1; if (sum < 0) return 0; if (c <= 0 && sum >= 1) return 0; return countRecursive(coins, c - 1, sum) + countRecursive(coins, c, sum - coins[c - 1]); }  static void main(String[] args); static int countOptimal(int[] coins, int amt); static int countRecursive(int coins[], int c, int sum); static void print();  }### Answer:
@Test public void testCoinChangeSolutionRecursive() { int coins[] = { 1, 2, 3 }; assertEquals(4, CoinChangeSolution.countRecursive(coins, coins.length, 4)); coins = new int[] { 1, 2, 3 }; assertEquals(5, CoinChangeSolution.countRecursive(coins, coins.length, 5)); coins = new int[] { 2, 5, 3, 6 }; assertEquals(5, CoinChangeSolution.countRecursive(coins, coins.length, 10)); }
@Test public void testCoinChangeSolutionRecursiveSpeed() { int coins[] = { 2, 5, 3, 6, 10, 7, 8, 12, 17, 19, 20 }; assertEquals(227491942, CoinChangeSolution.countRecursive(coins, coins.length, 250)); }