Longest Continuous Increasing Subsequence


  • 0

    Click here to see the full article post


  • 0
    G

    class Solution {
    public int findLengthOfLCIS(int[] nums) {
    int skip = 0,length = 1;
    for (int i = 0;i<nums.length -1;i++){
    if (nums[i+1]-nums[i] != 0){
    if(nums[i+1]-nums[i] == skip){
    length++;
    }else{
    skip = nums[i+1]-nums[i];
    }

            }else{
                skip = nums[i+1]-nums[i];
                length = 1;
            }
        }
        return length;
    }
    

    }


Log in to reply
 

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