Test case are not passing out

I have applied correct logic for the question can you ease help me out in this

hello @manikjindal49
pls share ur code using cb ide.

My solution link :-https://ide.geeksforgeeks.org/jGR5IYTtk5

@manikjindal49
image

a)
declare ur dp size of atleast n+2

b) apply mod in
dp[i]=(dp[i-1] + dp[i-2]) %mod;

the test case will still not pass becuase n is big .
try to do it in O(1) space .
hint -> this problem is same as calculating nth fibonnaci

Itis not showing any space complexity error it is showing that your answer is wrong please help me out with that

these changes are for removing wa only

i have done that changes alrady which you asked for then only it is showing the error

check now->

Still getting MLE error on last testcase

… . . . . . . . .

It is not passing as now time compexity is become a proble

@manikjindal49
if O(n) time and o(1) space solution is not passing then try matrix exponentiation.