Request code Tiling prob

please provide the code of this question

u can refer this https://ide.codingblocks.com/s/590162

In video return getNoOfWays(n - 1) + getNoOfWays(n - 2); is written as return getNoOfWays(n - 1) + getNoOfWays(n - 4);

actually there are 2 different tiling problems… which one are u referring to??
getNoOfWays(n - 1) + getNoOfWays(n - 2); this one is for tiling problem 1

Tiling Problem Recursion

I am unable to understand the solution, please help

the code i sent is for that only

Let “count(n)” be the count of ways to place tiles on a “2 x n” grid, we have following two ways to place first tile.

  1. If we place first tile vertically, the problem reduces to “count(n-1)”

  2. If we place first tile horizontally, we have to place second tile also horizontally. So the problem reduces to “count(n-2)”
    Therefore, count(n) can be written as below.

    count(n) = n if n = 1 or n = 2
    count(n) = count(n-1) + count(n-2)

we have to assume in every recursion that the smaller prob will be solved right?

yes… that’s what recursion does… break bigger problems into smaller ones and solve them

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.