Number of ways
Medium Accuracy: 29.49% Submissions: 1838 Points: 4

Given a value N. In how many ways you can construct a grid of size N x 4 using tiles of size 1 x 4.

Example 1:

Input: N = 1
Output: 1
Explaination: There is only one way.

Example 2:

Input: N = 4
Output: 2
Explaination: The first way can be when all 
the 1 x 4 tiles are arranged horizontally. 
Second way can be when all the 1 x 4 tiles 
are arranged vertically.

Your Task:
You do not need to read input or print anything. Your task is to complete the function arrangeTiles() which takes the value N as input parameter and returns the number of ways to make N x 4 grid using 1 x 4 tiles.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)

1 ≤ N ≤ 80

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Number of ways

Output Window