Only one test case is passed rest run error is showing

Kindly check it

hello @EkanshJain2323
r u getting tle ?

No I am getting Run Error

image

this m should not be here , it should be inside ur while loop (written in main).

Now I am getting TLE

recursive solution has exponential time complexity ,thats why u r getting tle,
use dynamic programming to improve ur time complexity

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.