Incorrect output


i.m not able to recognize where 2d dp has to be used, i want to solve it bu using recursive approach only.

@akshatkaush hey check this code and dry run it you will get where yo use 2d dp as through recursion all test cases will not be pass:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.