#K36637. Longest Increasing Subsequence Length

    ID: 25799 Type: Default 1000ms 256MiB

Longest Increasing Subsequence Length

Longest Increasing Subsequence Length

You are given a sequence of n integers. Your task is to compute the length of the longest strictly increasing subsequence.

A strictly increasing subsequence is a subsequence where every element is greater than the previous one. Formally, for a sequence \(a_1, a_2, \dots, a_n\), a subsequence \(a_{i_1}, a_{i_2}, \dots, a_{i_k}\) (with \(1 \le i_1 < i_2 < \cdots < i_k \le n\)) is strictly increasing if \(a_{i_1} < a_{i_2} < \cdots < a_{i_k}\).

Your solution should read from standard input and print the answer to standard output.

inputFormat

The first line contains an integer (n) which represents the number of elements in the sequence. The second line contains (n) space-separated integers.

outputFormat

Output a single integer representing the length of the longest strictly increasing subsequence.## sample

0
0

</p>