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.
Be the first one to answer
Add answer anonymously...
Adobe Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter