from my code i am getting 3 as ans for n=5 , but didnt get how it is possble???
what are the three cases , i only able to count 2 only!!
In case of n=5 what is the ans
your recursion is wrong.
This is correct one
int func(lli n)
{
if n<0 then return 0
else if n==0 return 1
else return (func(n-1)+func(n-2)) %1000000007
}
Here use dp to store subproblems too.
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.
we have tiles of size 1*4
then how can f(n-2) is possible