Code Showing MLE for 2 Test Cases

In my code, I have used top-down approach using memorisation, but it seems as if I have made a mistake in implementing the 2D DP vector. Kindly point out my error.
Thank You!!

Hey @paulayush2002 ,
Pass your DP array as a call by reference instead of call by value . In call by value the dp array is being copied at every function call which is wasting a lot of memory .
Pass it by reference like this vector<vector>& dp;

Hope it helps !! Happy coding !!