Issue with code

Can you pls tell what is wrong with the code I am implementing?

@pradhumangupta99 time complexity of recursion alone is very high, so you need to use memoization along with it.

The problem was not related to TLE, I am getting WA . So according to you, due to time complexity it is running for more time then expected by the problem and thus i am not getting the results as expected?

@pradhumangupta99 your recurrance relation is correct. I assumed it was a TLE since you did not specify what error you got. One more thing you should consider doing is taking mod of the values you get from the recursive calls, as their sum together might be too high.

I did that too but it is still showing an error

not error but wrong answer

@pradhumangupta99 please share the updated code by saving it on ide.codingblocks.com I cannot find it in your submissions

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.