华为上机机试练习--------------------矩形覆盖---------------------java语言描述
2021-05-23 19:28
标签:语言 style lse 重叠 pre target 覆盖 span code 题目描述 题解: 直接找规律,发现a[i] = a[i - 1] + a[i - 2]; 华为上机机试练习--------------------矩形覆盖---------------------java语言描述 标签:语言 style lse 重叠 pre target 覆盖 span code 原文地址:https://www.cnblogs.com/guodao/p/9734658.htmlpublic class Solution {
public int RectCover(int target) {
if(0 == target){
return 0;
}else if(1 == target){
return 1;
}
int[] res = new int[target+1];
res[0] = 1;
res[1] = 1;
for(int i = 2; i ){
res[i] = res[i-1] + res[i-2];
}
return res[target];
}
}
文章标题:华为上机机试练习--------------------矩形覆盖---------------------java语言描述
文章链接:http://soscw.com/index.php/essay/88342.html