I have derived the base conditions. Wanted to know if it is correct or not. if(n<0) return 0, if(n==0) return 1, if(n<4) return n.
If it is not correct please let me know the correct base conditions.
What are the base conditions in the tilling problem?
no
look n==0 that means there is no space left to fill with tile then how there can be a return 1
No my logic is that we get zero only when it is called by f(1) or f(4).
think like that
u can fill in 2 ways either horizontally or vertically
so like u start with 0
func(n,count,m)
if(count==n) then u have filled all
if (count>n) then u are trying to filling but not able
return func(n, count+1,m) filling horizontally + func(n,count+m,m) // filling vertically
if my recursive relation is f(n) = f(n-1) + f(n-4) taking m=4 then the base conditions I mentioned earlier are correct right?
if n<4 return n is wrong if n is 3 then there are not 3 ways otherwise right
if(n<0) return 0, if(n<=4) return 1.
This should work I guess for my recursive formula.
if n==4 return 2
because u can place horizontally 1×4
and vertically