classSolution {publicintintegerBreak(int n) {// value at index i refer to the ans of number i;int[] memo =newint[n+1]; memo[1]=1;for (int i=2; i<=n; i++){for (int j =1; j<=i/2; j++){// compare i-j with memo[i-j]; memo[i]=Math.max(memo[i], j*Math.max(i-j, memo[i-j])); } }return memo[n]; }}