Please check my code for tiling problem is it correct

#include
using namespace std;

int placeTiles(int n) {
//base case;
if(n <= 3) {
return 1;
}

int res = placeTiles(n - 1) + placeTiles(n - 4);
return res;

}
int main() {
int n;
cin >> n;
cout << placeTiles(n) << endl;

return 0;

}

hello @nitinchoudhary260

yeah it is correct.

So for input 5 output 3 is correct then

yes




Okk Sure Thanks for solving the doubt

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.