class Solution {
public int findLengthOfLCIS(int[] nums) {
if(nums == null || nums.length == 0)
return 0;
int sum = 1;
int p = 0;
int[] count = new int[nums.length];
for(int i = 1; i < nums.length; i++){
if(nums[i-1] < nums[i]){
sum++;
}else{
count[p] = sum;
sum = 1;
p = i;
}
}
count[p] = sum;
int max = 0;
for(int i = 0; i < count.length; i++){
if(count[i] > max)
max = count[i];
}
return max;
}
}
leetcode 674
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Java生成PDF文件,並將PDF轉爲圖片
引入依賴 <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId>