C++ || EASY || Memoization --->Tabulation || Faster than 100%
\n\nMemoization\n\n\nclass Solution {\nprivate:\n    int solve(int n,vector<int>& dp){\n        if(n==0 || n==1) return 1;\n        \n        if(dp[n]!=-1) retu
![image](https://assets.leetcode.com/users/images/49cb28e0-a3da-4dc0-97f1-7c35784fef15_1673631328.4229546.png)\n\n**Memoization**\n\n```\nclass Solution {\nprivate:\n    int solve(int n,vector<int>& dp){\n        if(n==0 || n==1) return 1;\n        \n        if(dp[n]!=-1) return dp[n];\n        \n        int maxi=0;\n        \n        for(int ind=1;ind<n;ind++){\n            int temp=max(ind*(n-ind), ind * solve(n-ind,dp));\n            maxi=max(maxi,temp);\n        }\n        return dp[n]=maxi;\n    }\npublic:\n    int integerBreak(int n) {\n        vector<int> dp(n+1,-1);\n        return solve(n,dp);\n    }\n};\n```\n\n**Tabulation**\n\n```\nclass Solution {\nprivate:\n    int solveTab(int n){\n        vector<int> dp(n+1,0);\n        \n        dp[0]=1;\n        dp[1]=1;\n     \n        for(int i=2;i<=n;i++){\n            int maxi=1;\n            for(int ind=1;ind<i;ind++){\n            int temp=max(ind*(i-ind), ind * dp[i-ind]);\n            maxi=max(maxi,temp);\n            }\n            dp[i]=maxi;\n        }\n        \n        return dp[n];\n    }\npublic:\n    int integerBreak(int n) {\n        return solveTab(n);\n    }\n};\n```\n\n
['Dynamic Programming', 'Recursion', 'C', 'C++']