Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).


Example 1:

Input: [1,3,5,4,7]
Output: 3
Explanation: The longest continuous increasing subsequence is [1,3,5], its length is 3. 
Even though [1,3,5,7] is also an increasing subsequence, it's not a continuous one where 5 and 7 are separated by 4. 



Example 2:

Input: [2,2,2,2,2]
Output: 1
Explanation: The longest continuous increasing subsequence is [2], its length is 1. 



Note:
Length of the array will not exceed 10,000.

Difficulty: introductory

Starter code:

class Solution:
    def findLengthOfLCIS(self, nums: List[int]) -> int:
        

Solutions:
class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if len(nums) < 1:
             return 0
         cur_len = 1
         max_len = 1
         for i in range(1,len(nums)):
             if nums[i] > nums[i-1]:
                 cur_len = cur_len + 1
             else:
                 cur_len = 1
                 
             if cur_len > max_len:
                 max_len = cur_len
         return max_len


class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if not nums:
             return 0
         result = 1
         max_result = 1
         for i in range(len(nums) - 1):
             if nums[i+1] > nums[i]:
                 result += 1
                 if result > max_result:
                     max_result = result
             else:
                 result = 1
         return max_result

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if not len(nums):
             return 0
         res = 0
         temp_res = 1
         for i in range(len(nums)-1):
             if nums[i] < nums[i+1]:
                 temp_res += 1
             else:
                 if temp_res > res:
                     res = temp_res
                 temp_res = 1
         return max(res, temp_res)

class Solution:
     def findLengthOfLCIS(self, nums):
         if nums == []:
             return 0
         elif len(nums) == 1:
             return 1
         ans, max_ans = 1, 1
         for i in range(len(nums) - 1):
             if nums[i] < nums[i + 1]:
                 ans += 1
                 max_ans = ans if ans > max_ans else max_ans
             else:
                 ans = 1
         return max_ans
         """
         :type nums: List[int]
         :rtype: int
         """


class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if not nums:
             return 0
         seq, max_seq = 1, 1
         for i in range(1, len(nums)):
             if nums[i] > nums[i-1]:
                 seq += 1
             else:
                 max_seq = max(max_seq, seq)
                 seq = 1
         max_seq = max(max_seq, seq)
         return max_seq

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         # if nums == []:
         #     return 0
         # ans,n = 1,1
         # for i in range(len(nums)-1):
         #     if nums[i+1]>nums[i]:
         #         n += 1
         #         ans = max(ans,n)
         #     else:
         #         n = 1
         # return ans
         ans = anchor = 0
         for i in range(len(nums)):
             if i and nums[i-1] >= nums[i]: anchor = i
             ans = max(ans, i - anchor + 1)
         return ans


class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if len(nums)==0:
             return 0
         temp,res=1,1
         for i in range(len(nums)-1):
             if nums[i]<nums[i+1]:
                 temp+=1
             else:
                 res=max(res,temp)
                 temp=1
         res=max(res,temp)
         return res

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if not nums:
             return 0
         
         longest = 0
         count = 1
         for i in range(1, len(nums)):
             if nums[i] > nums[i-1]:
                 count += 1
             else:
                 longest = max(longest, count)
                 count = 1
                 
         
         return max(longest, count) 


class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if not nums: return 0
         ret = 0
         cnt = 1
         for i in range(1,len(nums)):
             if nums[i]>nums[i-1]: cnt += 1
             else:
                 ret = max(ret, cnt)
                 cnt = 1
         return max(ret,cnt)

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         current_count = 0
         max_count = 0
         for index,num in enumerate(nums):
             current_count += 1
             if index < len(nums)-1:
                 if num >= nums[index+1]:
                     max_count = max(max_count, current_count)
                     current_count = 0
         return max(max_count, current_count)

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         LCIS = 0
         i = 0
         j = 1
         while j <= len(nums):
             if j == len(nums) or nums[j-1] >= nums[j]:
                 l = j - i
                 if LCIS < l: LCIS = l
                 i = j
             j += 1
         return LCIS

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         
         if nums == []:
             return 0
         longest = 1
         curr = 1
         
         for i in range(0,len(nums)-1):
             if nums[i]<nums[i+1]:
                 curr +=1
                 print(curr)
             else:
                 
                 longest = max(longest,curr)
                 curr = 1
         longest = max(longest,curr)
         return longest

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         if nums == []:
             return 0
         n = 1
         ans = [1,]
         for i in range(0,len(nums)-1):
             if nums[i+1]>nums[i]:
                 n += 1
             else:
                 ans.append(n)
                 n = 1
             if i == len(nums)-2:
                 ans.append(n)
         
         return max(ans)


class Solution:
     def findLengthOfLCIS(self, nums):
         ans = anchor = 0
         for i in range(len(nums)):
             if(nums[i - 1] >= nums[i]):
                 anchor = i
             ans = max(ans, i - anchor + 1)
         return ans

class Solution:
     def findLengthOfLCIS(self, nums):
         ans = anchor = 0
         for i in range(len(nums)):
             if i and nums[i-1] >= nums[i]: anchor = i
             ans = max(ans, i - anchor + 1)
         return ans

class Solution:
     def findLengthOfLCIS(self, nums):
         """
         :type nums: List[int]
         :rtype: int
         """
         counter = 1
         L = []
         if len(nums)>=2:
             for i in range(0,len(nums)-1):
                 if nums[i+1]>nums[i]:
                     counter+=1
                 else:
                     counter=1
                 L.append(counter)
             return max(L)
         elif len(nums)==1:
             return 1
         else:
             return 0