Another Implementation.

public int integerBreak(int n) { if (n <= 1) return 0; int [] dp = new int [n + 1]; dp [1] = 1; for (int idx = 2; idx <= n; idx ++) integerBreakInner (dp, idx); return dp [n]; } private int integerBreakInner (int [] dp, int n) { int ans = 0; for (int idx = 1; idx <= n/2; idx ++) ans = Math.max (ans, Math.max(idx, dp [idx]) * Math.max((n - idx), dp [n - idx])); return dp [n] = ans; }Integer Break