Please check solution

#include<bits/stdc++.h>
using namespace std;
int count(int n)
{
if(n<1)
return 0;
if(n==1)
return 1;
else
return count(n-1)+count(n-4);
}
int main()
{
int n;
cin>>n;
cout<<count(n);
return 0;
}
is this the correct solution for tiling problem?

Yes your approach is correct.

#include<bits/stdc++.h> using namespace std; int count(int n) { if(n<=0) return 0; else if(n<4) return 1; else return count(n-1)+count(n-2); } int main() { int n; cin>>n; cout<<count(n); return 0; }

please check for these base cases

Base cases must be like this:

if (n < 1)
    return 0;//Because tiling not possible 

if (n < 4)
    return 1;//Because now you have only 1 way to tile and that is to tile vertically 

if (n == 4)
    return 2; //Because now you have 2 ways- either tile all vertically or tile all horizontally

You can draw the structure and imagine.