MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / rodcut

Method rodcut

Leetcode/Java/RodCutting.java:16–26  ·  view source on GitHub ↗
(int price[], int n)

Source from the content-addressed store, hash-verified

14 System.out.println("Maximum Obtainable Value is " + rodcut(arr, size));
15 }
16 static int rodcut(int price[], int n)
17 {
18 if (n <= 0)
19 return 0;
20 int max = Integer.MIN_VALUE;
21
22 for (int i = 0; i < n; i++)
23 max = Math.max(max, price[i] + rodcut(price, n - i - 1));
24
25 return max;
26 }
27}
28
29

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected