public int findLengthOfLCIS(int[] nums) {
int len = nums.length;
if (len <= 1) {
return len;
}
int lp = 0, rp = 1;
int maxLen = 0;
while (lp < len && rp < len) {
if (nums[rp-1] >= nums[rp]) {
lp = rp;
}
rp++;
maxLen = Math.max(maxLen, rp - lp);
}
return maxLen;
}
leetCode 地址:674. 最长连续递增序列
题解
贪心