is this correct -
#include<bits/stdc++.h>
using namespace std;
int tiling(int n)
{
if(n==1)
return 1;
if(n==4)
return 2;
return tiling(n-1)+tiling(n-4);
}
int main()
{
int n;
cin>>n;
cout<<tiling(n);
return 0;
}
is this correct -
#include<bits/stdc++.h>
using namespace std;
int tiling(int n)
{
if(n==1)
return 1;
if(n==4)
return 2;
return tiling(n-1)+tiling(n-4);
}
int main()
{
int n;
cin>>n;
cout<<tiling(n);
return 0;
}
that’s not number of titles, actually that are 2 ways to arrange the tiles
@Akshay123 hey your base case are corrected bs agr n<m hoga to sab cases me 1 ayega ans ,these are base cases:
if(n==m)
return 2;
if(n<m)
return 1;
And use dp here ,recursion may give TLE.
thanks man, I appreciate your hard work,keep going