```
static vector<int> dp;
class Solution {
public:
int integerBreak(int n) {
if (dp.empty()) {
dp.push_back(0);
dp.push_back(1);
}
if (dp.size() >= n) return dp[n-1];
for (int i = dp.size(); i < n; i ++) {
int cur = 0;
for (int k = i - 1; k > 0; k--) {
cur = max(cur, max(k, dp[k - 1]) * max(i - k + 1, dp[i - k - 1]));
}
dp.push_back(cur);
}
return dp[n - 1];
}
};
```