Longest Increasing Subsequence
Find the length of the longest strictly increasing subsequence. DP works for small ; the patience-sorting trick with binary search is .
Input
, then integers.
Output
The LIS length.
Constraints
Sample 1
Input
8 10 9 2 5 3 7 101 18
Output
4
Sample 2
Input
3 7 7 7
Output
1