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

one test case still not passing

Please check the constraints.

on which constraint am i going wrong… cant understand

Sorry ,I misinterpreted the constraints
So pass vectors by reference and your issue will be resolved otherwise a copy of vector will be made for each call.
Also do not forget to mark this as resolved :slight_smile: