Pls tell error in this code.. 2 test case not passing

Hey @Vaibhav277
Pure recursive solution without dp will give TLE. Apply memoization/dp to pass all the test cases

Note: If u haven’t studied DP yet, then skip this question for now and come back to it later

actually i tried making a dp array as well … then output is coming zero… can u pls make changes in my code so that i can understand it

@Vaibhav277
Send me that code and I will tell you what you are doing wrong.

Hey @Vaibhav277 its running fine on my side and giving output 13 for this test case:
5 4
1 2 3 2 2
8 4 0 5 3