题解 | #矩形覆盖#
矩形覆盖
http://www.nowcoder.com/practice/72a5a919508a4251859fb2cfb987a0e6
关注n,第n个中一个竖着覆盖,那么关注n-1,如果横着盖,则需要两个,关注n-2 n-1和n-2覆盖的和
public class Solution {
public int rectCover(int target) {
if(target == 0){
return 0;
}
if(target == 1){
return 1;
}
if(target == 2){
return 2;
}
return rectCover(target-1)+rectCover(target-2);
}
}