| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/j2cms/Java/master/DynamicProgramming/RodCutting.java | [Back] [Original] |
package DynamicProgramming;
/**
* A DynamicProgramming solution for Rod cutting problem
* Returns the best obtainable price for a rod of
* length n and price[] as prices of different pieces
*/
public class RodCutting {
private static int cutRod(int[] price, int n) {
int val[] = new int[n + 1];
val[0] = 0;
for (int i = 1; i
| Web Proxy Viewer | New URL | Original Page |