package leetcode;

/**
 * https://leetcode.com/problems/coin-change-2/
 */
public class Problem518 {
    public int change(int amount, int[] coins) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem518 prob = new Problem518();
        System.out.println(prob.change(5, new int[]{1, 2, 5})); // 4
        System.out.println(prob.change(3, new int[]{2})); // 0
        System.out.println(prob.change(10, new int[]{10})); // 1
    }
}


@@ -155,33 +155,483 @@
     
-// TODO%0A        return 0;
+Result result = new Result();%0A        change(amount, coins, result);%0A        return result.result;%0A    %7D%0A%0A    private static class Result %7B%0A        private int result;%0A    %7D%0A%0A    private static void change(int amount, int%5B%5D coins, Result result) %7B%0A        if (amount %3C= 0) %7B%0A            if (amount == 0) %7B%0A                result.result++;%0A            %7D%0A            return;%0A        %7D%0A        for (int coin : coins) %7B%0A            change(amount - coin, coins, result);%0A        %7D
 %0A   
@@ -792,16 +792,18 @@
 ); // 4%0A
+//
         
@@ -857,16 +857,18 @@
 ); // 0%0A
+//
         
@@ -930,11 +930,9 @@
 1%0A    %7D%0A
+
 %7D
-%0A%0A

Update problem 518