public class Solution { public int cutRope(int target) { if(target == 2) return 1; int r = 1; for(int i = 1; i <= target/2; ++i){ r = Math.max(i*cutRope(target - i), i*(target - i)); } return r; } }
public class Solution { public int cutRope(int target) { if(target == 2) return 1; int r = 1; for(int i = 1; i <= target/2; ++i){ r = Math.max(i*cutRope(target - i), i*(target - i)); } return r; } }