i didn’t get the logic of prateek sir…plzz simplify the logic
Tilong problem;given 4*N wall,and tiles of size 4*1,to find total number of ways to arange tiles on wall
#include
using namespace std;
int count(int n)
{
if(n==1||n==2||n==3)
return 1;
if(n==4)
return 2;
return (count(n-1)+count(n-4));
}
int main()
{
int n;
cin>>n;
cout<<count(n);
return 0;
}
//plzz check if code is correct or not
yes your logic is correct
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.
1 Like