class Solution {
public int findLengthOfLCIS(int[] nums) {
int result = 0;
int start = 0;
for (int i = 0; i < nums.length; i++) {
if (i > 0 && nums[i] <= nums[i - 1]) {
start = i;
}
result = Math.max(result, i - start + 1);
}
return result;
}
}
674.最长连续递增序列
最新推荐文章于 2025-12-06 07:43:37 发布
该博客介绍了一个用于查找整数数组中最长递增子序列的算法。通过遍历数组,更新起始位置并计算当前子序列长度,最终找到最长递增子序列的长度。此算法在处理序列优化问题时具有实用性。
259

被折叠的 条评论
为什么被折叠?



