Place the tiles

Given a “2 x n” board and tiles of size “2 x 1”, print the number of ways to tile the given board using the 2 x 1 tiles. A tile can either be placed horizontally i.e., as a 1 x 2 tile or vertically i.e., as 2 x 1 tile.
Input Format

The only line of the input contains N to represent the second dimension of the board.
Constraints

1<= N < 100000000
Output Format

Print the number of ways to tile the given board .

Note: Since the answer can be huge, print ans % 1000000007.
Sample Input

3

Sample Output

3

Hey @Kash-Moulik-3715574511847721
What is the issue in it ?

Im not able to get the que so can u help me with it (prograaming soln with it too)

So question is pretty simple
You are given a 2xN board ,lets assume 2 cols and n rows

And 1x2 sized tiles ,now u have to place tiles on the board such that board is completely filled.U have to tell the no of ways to do this

So for N=3 board is 3x2
See this


I insist u to try this on ur own first, let me know if u are not ablel to solve it
Hint : No of rows decrease by 1 if placed horizontally and 2 if placed vertically.

yeah I tried it but not able to solve so can u send cpp soln

Its just simple finacci series
f(n)=f(n-1)+f(n-2)
So just code out for nth Fibonacci number
where for n=1 ans is 1 ans n=2 ans is 2

ok so soln pls cpp soln

Hey @Kash-Moulik-3715574511847721


int main(){
      int n;
      cin>>n;
      if(n==0||n==1){
            cout<<1;
      }
      else{
            int a=1,b=1;
            for(int i=2;i<=n;i++){
                  int c=(a+b)%1000000007;
                  a=b;
                  b=c;
            }
            cout<<b;
      }
return 0;
}