Matrix covering (Fibonacci number)

Title Description

We can use a small rectangle 2 * 1 sideways or vertically to cover a larger rectangle. Will the small rectangle of n 2 * 1 coverage without overlap a large rectangle 2 * n, a total of how many ways?
Fibonacci columns can be, do not want to list more of the solution
code show as below:
public class Solution {
    public int RectCover(int n) {
    if(n==0) return 0;    
    if(n==1) return 1;
    else if(n==2) return 2;
    return RectCover(n-1)+RectCover(n-2);    
    }
}

Guess you like

Origin www.cnblogs.com/cstdio1/p/11233585.html