标签:语言 style lse 重叠 pre target 覆盖 span code
题目描述
题解:
直接找规律,发现a[i] = a[i - 1] + a[i - 2];
public 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 <= target; i++){ res[i] = res[i-1] + res[i-2]; } return res[target]; } }
华为上机机试练习--------------------矩形覆盖---------------------java语言描述
标签:语言 style lse 重叠 pre target 覆盖 span code
原文地址:https://www.cnblogs.com/guodao/p/9734658.html