I find the mathematical solution first then came up with this solution to handle integer only.

Mathematically, the optimal base amount is actually e=2.71828.

In other words, given N, e^(N/e) is the maximal product you can get by breaking N into N/e numbers;

To handle integer, just need to do some special handling.

```
class Solution {
int n;
int solve(int k)
{
if (k < 2)
return 0;
int a = n/k;
int m = n - a * k;
return pow(a+1, m) * pow(a, k - m);
}
public:
int integerBreak(int i) {
n = i;
int k = max(n/2.718281828459, 2.0);
return max(solve(k - 1), max(solve(k + 1), solve(k)));
}
};
```