THIS QUESTION IS UNDER RECURSION SECTION AND I HAVE NOT REACHED TO DP LECTURES......PLEASE CHECK WHY "TLE" IS COMING

#include<bits/stdc++.h>
using namespace std;
int tilling(int n,int m)
{if(n>=1&&n<m)
{return 1;}
else if(n==m)
{
return 2;
}

return tilling(n-1,m)+tilling(n-2,m);

}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t–){
int n,m;
cin>>n>>m;
int ans=tilling(n,m);
ans%=(1000000000+7);
cout<<ans<<endl;
}
return 0;
}

Yes it’s a DP problem, don’t worry you can come back to it once you are done with DP!
Still from recursion point of view you have some bugs!
1 . return tilling(n-1,m)+tilling(n-m,m);
2. taking mod at final answer will not help, you should do as:
return (tilling(n-1,m)+tilling(n-m,m))%1000000007;

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.