When I am trying to use 2D vector for Memoisation , on submit it is showing memory limit exceeded. How we can solve it in using 1D dp.
Memory Limit Exceeded
@D19APPND0003
We can also solve this problem in bottom-up manner. In the bottom-up approach, we solve smaller sub-problems first, then solve larger sub-problems from them. The following bottom-up approach computes , for each and , which is true if subset with sum j can be found using items up to first i items. It uses value of smaller values i and j already computed. It has the same asymptotic run-time as Memoization but no recursion overhead.
editorial code for reference