Same answer is coming again


link to the solution

hello @manikjindal49
a) u r declaring ur dp array again n again for each function call which is wrong.
make it global (also check value of n from constraints and declare size accordingly)

b) if (dp[n]!=0) then simply return dp[n] withput looking for any condition

c) check output format u r asked to print ans%1000000007

i have now declaared the dp in main function and also i have already given condition cn you please do some changes in my code so that i can understaand that

@manikjindal49
pls share ur updated code

after making these changes, i will see and make corrections if needed

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.