674_Longest Continuous Increasing Subsequence
Given an unsorted array of integers, find the length of longestcontinuous
increasing subsequence (subarray).
Example 1:
Example 2:
Note:Length of the array will not exceed 10,000.
Solution
我们可以使⽤⼀个计数器 curLength,如果遇到⼤的数字,计数器⾃增1 ;如果是⼀个⼩的数字,则计数器重置为1 。同时需要迭代目前为止的最大长度 maxLength.
Time O(n) Space O(1)
Last updated
Was this helpful?