06. Ways To Tile A Floor
β GFG solution to the Ways to Tile a Floor problem: compute the number of ways to fill a 2Γn board using 2Γ1 tiles via dynamic programming or Fibonacci logic. π
π§© Problem Description
π Examples
Example 1
Input: n = 3
Output: 3
Explanation: We need 3 tiles to tile the board of size 2 Γ 3.
We can tile in following ways:
1) Place all 3 tiles vertically.
2) Place first tile vertically and remaining 2 tiles horizontally.
3) Place first 2 tiles horizontally and remaining tiles vertically.Example 2
π Constraints
β
My Approach
Iterative Dynamic Programming
π Time and Auxiliary Space Complexity
π§βπ» Code (C++)
β Code (Java)
π Code (Python)
π§ Contribution and Support
πVisitor Count
Last updated