Given an integer array nums, determine whether there exists a subsequence of length three such that the three values are strictly increasing. Pattern focus: LIS. Identify the smallest possible first, second, and third values while scanning once from left to right.
nums = array of integers
true if an increasing subsequence of length 3 exists, otherwise false
Example 1:
Input:
nums = [1,2,3,4,5]
Output:
true
Explanation:
The subsequence 1, 2, 3 is strictly increasing.
Example 2:
Input:
nums = [5,4,3,2,1]
Output:
false
Explanation:
There is no increasing subsequence of length 3.
Example 3:
Input:
nums = [2,1,5,0,4,6]
Output:
true
Explanation:
The subsequence 1, 4, 6 is strictly increasing.