![]() Tiling Problem Description We are given a land of 2*n. In this article, we have a C solution with an explanation. The problem has a similar solution as the Fibonacci number using dynamic programming. Tiling Problem In the tiling problem, we have to find the number of ways to fill a board. Recurrence formula is as mentioned below : count (n) = n if n = 1 or n = 2 count (n) = count (n-1) count (n-2) Explanation is as follows : count (n-1) : If the first tile is placed vertically, then problem reduces to a grid of size "2 x (n-1)" count (n-2) : If the first tile is placed horizontally, then problem reduces to a grid of size "2 x (n-2)", because we will need to place two tiles.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |