/*
 * Implementation of famous dynamic programming problem
 * that aims to find out the maximum number of ways in
 * which a value can be achieved using some fixed valued
 * coins.
 *
 * In the implementation, the time complexity is O(mn)
 * and extra space required is O(n).
 */
import java.util.Arrays;
/*
 * coin: Array containing value of coins
 * n: Value to find the change for
 */
public class CoinChangeProblem {
    public static int coinChangeProblem(int[] C, int n) {
        int[] possibilities = new int[n+1];
        Arrays.fill(possibilities, 0);
        possibilities[0] = 1;
        // Build the possibilities table in bottom-up manner
        // For all coins,
        // Update array if the current coin is capable of
        // incrementing the possibility
        for (int i = 0; i < C.length; i++){
            for (int j = C[i]; j <= n; j++){
                possibilities[j] += possibilities[j - C[i]];
            }
        }
        return possibilities[n];
    }

    public static void main(String[] args) {
        int[] coin = {2, 5, 3, 6};
        int n = 10;
        System.out.println(coinChangeProblem(coin, n));
    }
}

@@ -1,11 +1,80 @@
-/*%0A
+import java.util.Arrays;%0A%0Apublic class CoinChangeProblem %7B%0A%0A    /**%0A    
  * Imple
@@ -121,16 +121,20 @@
 problem%0A
+    
  * that 
@@ -180,16 +180,20 @@
 ways in%0A
+    
  * which
@@ -241,16 +241,20 @@
  valued%0A
+    
  * coins
@@ -256,18 +256,26 @@
 coins.%0A 
-*%0A
+    *%0A    
  * In th
@@ -321,16 +321,20 @@
 s O(mn)%0A
+    
  * and e
@@ -367,151 +367,72 @@
 ).%0A 
-*/%0Aimport java.util.Arrays;%0A/*%0A * coin: Array containing value of coins%0A * n: Value to find the change for%0A */%0Apublic class CoinChangeProblem %7B
+    *%0A     * @param coins%0A     * @param n%0A     * @return%0A     */
 %0A   
@@ -478,16 +478,24 @@
 t%5B%5D 
-C
+coins
 , int 
-n
+value
 ) %7B%0A
@@ -536,10 +536,16 @@
 int%5B
-n+
+value + 
 1%5D;%0A
@@ -826,17 +826,21 @@
  0; i %3C 
-C
+coins
 .length;
@@ -844,16 +844,17 @@
 th; i++)
+ 
 %7B%0A      
@@ -872,17 +872,21 @@
 int j = 
-C
+coins
 %5Bi%5D; j %3C
@@ -891,15 +891,20 @@
  %3C= 
-n
+value
 ; j++)
+ 
 %7B%0A  
@@ -955,17 +955,21 @@
 ies%5Bj - 
-C
+coins
 %5Bi%5D%5D;%0A  
@@ -1019,17 +1019,21 @@
 ilities%5B
-n
+value
 %5D;%0A    %7D
@@ -1097,16 +1097,17 @@
 t%5B%5D coin
+s
  = %7B2, 5
@@ -1127,17 +1127,21 @@
     int 
-n
+value
  = 10;%0A 
@@ -1192,11 +1192,16 @@
 coin
+s
 , 
-n
+value
 ));%0A

Fix #565: Improve docs and variable names for coin change problem [Java] (#565)