Give an integer array，find the longest increasing continuous subsequence in this array.

An increasing continuous subsequence:

Can be from right to left or from left to right.
Indices of the integers in the subsequence should be continuous.

O(n) time and O(1) extra space.

Solution

We can solve this problem using 2 linear scans. The first goes from the beginning of the array to the end; the other in reverse direction. During the scan, we count the continuous increasing elements, and the longest sequence.