A simple C solution [Accepted]


  • 0
    B
    int findLengthOfLCIS(int* nums, int numsSize) {
        if(numsSize==0)
        {
            return 0;
        }
        int temp=1;
        int result=1;
        for(int i=1;i<numsSize;i++)
        {
            if(nums[i]>nums[i-1])
            {temp++;}
            else
            {
                if(result<temp)
                {result=temp;}
                temp=1;
            }
        }    
        if(result<temp)
        {result=temp;}
        return result;
    }
    

Log in to reply
 

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