tiling problem recursion ? how f(0)=1;
Tiling problem recursion?
what is the base case here ? and how to find base case in these type of problems
f(0)=1, but in your code its zero . ?
@mehulbhandari358 actually sir assumed f(0)=1 only for the case n=4
as f(4)=f(3)+f(0) which should be equal to 2
but i made a separate base case for n==4 so thats why f(0)=0. you can do anything you like
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.
okay but the answer will vary for n=0 ?
no i am asking if the user entered 0 as an input then what will be the answer
@mehulbhandari358 if n==0 is allowed then it would be given in the question what to take but most prob constraints will start from n>=1