【leetcode】最长连续递增序列

 

int findLengthOfLCIS(int* nums, int numsSize){
    int i,count=1,max=1;
    for (i=1; i<numsSize; i++)
    {
        if (nums[i] > nums[i-1])
        {
            count++;        
        }
        else
        {
            if (count > max) max = count;
            count=1;
        }
    }
    if (count > max) max = count;
    return (numsSize)? max: 0;
}

 

posted @ 2020-09-22 17:02  温暖了寂寞  阅读(143)  评论(0编辑  收藏  举报