Can you pls tell wh my code gives tle? I think it’s complexity is O(n) only which shouldn’t give tle.
int tile(int n, int m)
{
if(n==1 | n<m) return 1;
else if( n==m ) return 2;
else {int ans = tile(n-1,m) + tile(n-m,m);
return ans;}
}
int main()
{
int t; cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
int ans=1;
int tiles = tile(n,m);
cout<<tiles<<endl;
}
return 0;
}