JAVA | DP NO MATHS ✔
\nclass Solution {\n    public int integerBreak(int n) {\n        int[] dp = new int[n+1];\n        Arrays.fill(dp,-1);\n        return helper(n,n,dp);\n    }\n
```\nclass Solution {\n    public int integerBreak(int n) {\n        int[] dp = new int[n+1];\n        Arrays.fill(dp,-1);\n        return helper(n,n,dp);\n    }\n    \n    private int helper(int n,int q,int[] dp){\n        if(n == 1)return 1;\n        if(dp[n] != -1)return dp[n];\n        \n        int ans = (n == q)? 0 : n;\n        for(int i = 1; i < n; i++){\n            \n            int c = helper(i,n,dp) * helper(n-i,n,dp);\n            ans = Math.max(c,ans);\n        }\n        dp[n] = ans;\n        return ans;\n    }\n    \n}\n```
['Dynamic Programming', 'Java']