LeetCode674. 最长连续递增序列

class Solution {
    public int findLengthOfLCIS(int[] nums) {
        if (nums == null || nums.length == 0) return 0;
        int res = 1;
        int len = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i-1]) {
                len ++;
                res = Math.max(res, len);
                continue;
            }
            len = 1;
        }
        return res;
    }
}

 

posted @ 2021-01-10 19:06  不学无墅_NKer  阅读(77)  评论(0)    收藏  举报