该题还是斐波那契数列,直接上代码
public class Solution {
public int RectCover(int target) {
if(target<=2){
return target;
}else{
int first=1,second=2;
target-=2;
while(target-->0){
int tmp=second;
second+=first;
first=tmp;
}
return second;
}
}
}