[C++] Memoized Solution
Consider n as the weight of the knapsack, and you\'ve to maximize the product of the values you choose (1 to n-1). Three choices exist for every item in the val
Consider n as the weight of the knapsack, and you\'ve to maximize the product of the values you choose (1 to n-1). Three choices exist for every item in the value array - either choose and continue, choose again recursively, do not choose.\n```\nint t[60][60];\nint maxproduct(vector<int> val, int n, int W){\n\tif(!W) return 1;\n\tif(!n) return 0;\n\tif(t[n][W]!=-1)  return t[n][W];\n\tif(val[n-1]<=W){\n\t\treturn t[n][W]=max(val[n-1]*maxproduct(val,n,W-val[n-1]),\n\t\t\t            \t        maxproduct(val,n-1,W));\n\t}\n\treturn t[n][W] = maxproduct(val,n-1,W);\n}\n\nint integerBreak(int n) {\n\tvector<int> val;\n\tmemset(t,-1,sizeof(t));\n\tfor(int i=1;i<n;i++)\n\t\tval.push_back(i);\n\treturn maxproduct(val,n-1,n);\n}\n```
['Dynamic Programming', 'Memoization', 'C', 'C++']