Typical example
Input
nums = [10, 9, 2, 5, 3, 7, 101, 18]
Output
4
One LIS is [2, 3, 7, 101], which has length 4.
Full lesson preview
Compute the length of the longest strictly increasing subsequence in an array of integers.
Problem statement
Task
Examples
Input
nums = [10, 9, 2, 5, 3, 7, 101, 18]
Output
4
One LIS is [2, 3, 7, 101], which has length 4.
Input format
Output format
Constraints
Samples
Input
nums = [3, 10, 2, 1, 20]
Output
3
A LIS is [3, 10, 20] of length 3.