Longest Increasing Subsequence

easy
1.Given an unsorted array of integers
 2.Find the length of longest increasing subsequence.
 3.You have to complete the function lis() which should print the length of the longest increasing subsequence.

Input Format

First line contains an Integer 'N' denoting the size of the array. Second line contains 'N' space separated elements of the array.

Output Format

Print the length of the longest increasing subsequence.

Constraints

1<=n<=10^4

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
8
10 9 2 5 3 7 101 18
Output
4
Previous
Longest Common Substring
Next
Distinct Transformations

Related Questions