Tiling problem 2

Testcase not matching

CODE

#include
#include
using namespace std;
long int no_of_ways(int n,int m,long int* ans){

if(n<m){
	return 1;
}
if(ans[n]==0)
{
 	ans[n]=no_of_ways(n-1,m,ans)+no_of_ways(n-m,m,ans);
	
}
return ans[n];
//return ret+ret2;

}
int main() {
int t,*n,*m;
cin>>t;
n=new int[t];
m=new int[t];
int i=0;
long int ans[100001]{0};
while(i<t){

	cin>>n[i]>>m[i];
	i++;
}
i=0;
while(i<t){
	
	cout<<no_of_ways(n[i],m[i],ans)<<endl;
	for(int j=0;j<=100000;j++){
		ans[j]=0;
	}
	i++;
}
return 0;

}

Hey @hrithik-1
Please share ur code in CB IDE

Just do modulo here (see the output format)

  ans[n]=(no_of_ways(n-1,m,ans)+no_of_ways(n-m,m,ans))%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.