
int res=1;
for (int i = 0; i < nums.length-1; i++) {
int count=1,temp=nums[i];
for (int j = i+1; j <nums.length ; j++) {
if(nums[j]>temp){
temp=nums[j];
count++;
}else{
break;
}
res=Math.max(res,count);
}
}
return res;
本文介绍了一种使用递归实现的算法,用于寻找整数数组中最大连续子数组的和。通过两层循环和计数器,程序找到并返回了最长递增子序列的长度,展示了在编程中如何处理数组问题的技巧。
669

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



