@@ -0,0 +1,1703 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0A/**%0A*   Solution to https://www.hackerrank.com/challenges/coin-change/%0A*/%0Apublic class Solution %7B%0A%0A    private static long%5B%5D%5B%5D cache;%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A%0A        int%5B%5D sizes = readNumbers(in);%0A        int amount = sizes%5B0%5D;%0A        int coinTypes = sizes%5B1%5D;%0A%0A        int%5B%5D coins = readNumbers(in);%0A        Arrays.sort(coins);%0A%0A        cache = new long%5Bamount + 1%5D%5Bcoins.length + 1%5D;%0A%0A        System.out.println(combs(coins, coins.length, amount, %22%22));%0A    %7D%0A%0A    private static long combs(int%5B%5D coins, int n, int amount, String pattern) %7B%0A        if (n == 0) %7B%0A            return 0;%0A        %7D%0A%0A        if (amount == 0) %7B%0A            return 1;%0A        %7D%0A%0A        if (amount %3C 0) %7B%0A            return 0;%0A        %7D%0A%0A        if (cache%5Bamount%5D%5Bn%5D != 0) %7B%0A            return cache%5Bamount%5D%5Bn%5D;%0A        %7D%0A%0A        int lastCoin = coins%5Bn - 1%5D;%0A        int%5B%5D coinsHead = Arrays.copyOf(coins, coins.length - 1);%0A%0A        long combs = combs(coins, n, amount - lastCoin, pattern + lastCoin) + //combs that make use of last coin (thus amount reduced)%0A                     combs(coinsHead, n - 1, amount, pattern); //combs that don't use the last coin%0A%0A        cache%5Bamount%5D%5Bn%5D = combs;%0A%0A        return combs;%0A    %7D%0A%0A    private static int%5B%5D readNumbers(Scanner in) %7B%0A        String next = in.nextLine();%0A        String%5B%5D split = next.split(%22 %22);%0A%0A        int%5B%5D numbers = new int%5Bsplit.length%5D;%0A%0A        for (int i = 0; i %3C split.length; i++) %7B%0A            numbers%5Bi%5D = Integer.parseInt(split%5Bi%5D);%0A        %7D%0A%0A        return numbers;%0A    %7D%0A%7D%0A

Create coin-change.java