题目
题源
代码
码源
class Solution {
public int integerBreak(int n) {
int[] dp = new int[n + 1];
for (int i = 2; i <= n; i++) {
int curMax = 1;
for (int j = 1; j <= n; j++) {
curMax = Math.max(curMax, Math.max((i - j) * j, (i - j) * dp[j]));
}
dp[i] = curMax;
}
return dp[n];
}
}