Tiling Problem Statement
Given a board with 2 rows and N columns, and an infinite supply of 2x1 tiles, determine the number of distinct ways to completely cover the board using these tiles.
You can place each tile:
1. Horizontally as a 1x2 tile
2. Vertically as a 2x1 tile
Input:
N
Output:
The number of ways to tile the board modulo 10^9 + 7
Example:
Input:
N = 4
Output:
5
Explanation:
The image shows an example of possible tile arrangements for a board size of N = 4. The board is completely covered using the available tiles in multiple distinct configurations.
Constraints:
- 1 <= N <= 1018
- Time limit: 1 sec
Note:
You are not required to print the output explicitly, just implement the function as the printing is handled by the system.

AnswerBot
2mo
Determine distinct ways to cover a 2-row N-column board using 2x1 tiles, either horizontally or vertically.
Dynamic Programming Approach: Use a recurrence relation to calculate the number of ways to ti...read more
Help your peers!
Add answer anonymously...
Adobe Software Developer Intern interview questions & answers
A Software Developer Intern was asked Q. Unbounded Knapsack Problem Statement Given ‘N’ items, each with a specific profi...read more
A Software Developer Intern was asked Q. Minimum Cost to Make String Valid Given a string containing only '{' and '}', de...read more
A Software Developer Intern was asked Q. Digit Count In Range Problem Statement Given an integer K, and two numbers A and...read more
Popular interview questions of Software Developer Intern
A Software Developer Intern was asked Q1. Unbounded Knapsack Problem Statement Given ‘N’ items, each with a specific profi...read more
A Software Developer Intern was asked Q2. Minimum Cost to Make String Valid Given a string containing only '{' and '}', de...read more
A Software Developer Intern was asked Q3. Digit Count In Range Problem Statement Given an integer K, and two numbers A and...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

