[Java] Easy solution


  • 0
    S
    class Solution {
        public int findLengthOfLCIS(int[] nums) {
            if (nums.length == 0) return 0;
            int seq = 1, cis = 1; 
            for (int i = 0; i < nums.length - 1; ++i) {
                if (nums[i] - nums[i + 1] < 0) seq++;
                cis = Math.max(cis, seq);
                if (nums[i] - nums[i + 1] >= 0) seq = 1;    
            }
            return cis;
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.