package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/coin-change
 */
public class CoinChange {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
    }
}

@@ -14,16 +14,64 @@
 rrank;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A
 import j
@@ -185,90 +185,790 @@
    p
-ublic static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in
+rivate static int coinChange(int n, int%5B%5D coins) %7B%0A        return coinChange(n, coins, new HashMap%3C%3E());%0A    %7D%0A%0A    private static int coinChange(int n, int%5B%5D coins, Map%3CInteger, Integer%3E memo) %7B%0A        if (n %3C 0) %7B%0A            return 0;%0A        %7D%0A        if (n == 0) %7B%0A            return 1;%0A        %7D%0A        int numChange = 0;%0A        for (int coin : coins) %7B%0A            numChange += coinChange(n - coin, coins, memo);%0A        %7D%0A        return numChange;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        int n = in.nextInt();%0A        int m = in.nextInt();%0A        int%5B%5D coins = new int%5Bm%5D;%0A        for (int i = 0; i %3C m; i++) %7B%0A            coins%5Bi%5D = in.nextInt();%0A        %7D%0A        System.out.println(coinChange(n, coins)
 );%0A 

Update Coin Change