@@ -0,0 +1,873 @@
+package problems;%0A%0Aimport java.util.Arrays;%0A%0A/**%0A * Leetcode: Coin Change%0A * Created by alan on 2/23/2016.%0A */%0Apublic class CoinChange %7B%0A    public int coinChange(int%5B%5D coins, int amount) %7B%0A        int%5B%5D count = new int%5Bamount + 1%5D;%0A%0A        for (int i = 1; i %3C= amount; i++) %7B%0A            int min = -1;%0A            for (int c : coins) %7B%0A                int t = i - c; // previous amount to add coin c%0A                if (t %3E= 0 && count%5Bt%5D %3E= 0 && (min %3C 0 %7C%7C min %3E count%5Bt%5D + 1))%0A                    min = count%5Bt%5D + 1;%0A            %7D%0A            count%5Bi%5D = min;%0A        %7D%0A        return count%5Bamount%5D;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        CoinChange cc = new CoinChange();%0A        int%5B%5D coins = %7B1, 2, 5%7D;%0A        int amount = 11;%0A%0A        System.out.println(Arrays.toString(coins) + %22 - %22 + amount + %22 : %22 + cc.coinChange(coins, amount));%0A    %7D%0A%7D%0A

Add Coin Change