@@ -0,0 +1,1447 @@
+package com.github.conradoqg.studydsa.hackerrank.challenges.ctci;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Scanner;%0A%0Apublic class CoinChange %7B%0A    public static long makeChange(int%5B%5D coins, int n) %7B%0A        if (n %3C 0) %7B%0A            return 0;%0A        %7D%0A        return makeChange(coins, n, 0, new HashMap%3CString, Long%3E());%0A    %7D%0A%0A    public static long makeChange(int%5B%5D coins, int n, int coinNumber, HashMap%3CString, Long%3E cache) %7B%0A        String key = n + %22,%22 + coinNumber;%0A        if (cache.containsKey(key)) %7B%0A            return cache.get(key);%0A        %7D%0A%0A        if (coinNumber == coins.length - 1) %7B%0A            if (n %25 coins%5BcoinNumber%5D == 0) %7B%0A                cache.put(key, 1L);%0A                return 1;%0A            %7D else %7B%0A                cache.put(key, 0L);%0A                return 0;%0A            %7D%0A        %7D%0A%0A        long ways = 0;%0A        for (int i = 0; i %3C= n; i += coins%5BcoinNumber%5D) %7B%0A            ways += makeChange(coins, n - i, coinNumber + 1, cache);%0A        %7D%0A%0A        cache.put(key, ways);%0A        return ways;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        try (Scanner scan = new Scanner(System.in)) %7B%0A            int n = scan.nextInt();%0A            int m = scan.nextInt();%0A            int%5B%5D coins = new int%5Bm%5D;%0A            for (int i = 0; i %3C m; i++) %7B%0A                coins%5Bi%5D = scan.nextInt();%0A            %7D%0A            scan.close();%0A%0A            System.out.println(makeChange(coins, n));%0A        %7D%0A    %7D%0A%7D%0A

Add coin change CTCI challenge