Longest Increasing Subsequence II


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Problem type
Allowed languages
C++, Python

Longest Increasing Subsequence

Given a sequence of length N, find the length of the longest strictly increasing subsequence.

Input Format

The first line contains an integer N.

The second line contains N integers, representing the complete sequence.

Output Format

Output an integer representing the maximum length.

Constraints

1 ≤ N ≤ 100000

-109 ≤ Sequence elements ≤ 109

Sample Input

7
3 1 2 1 8 5 6

Sample Output

4

Comments

There are no comments at the moment.