Longest Increasing Subsequence
A subsequence keeps some of an array's numbers in their original order, dropping the rest. Given nums, return the length of its longest strictly increasing subsequence (each number bigger than the one before it).
Constraints
- 1 ≤ length of
nums≤ 2,500 - -10,000 ≤
nums[i]≤ 10,000
Example 1
Input
nums = [10,9,2,5,3,7,101,18]
Output
4
Why:
For example 2, 3, 7, 101.
Example 2
Input
nums = [7,7,7,7]
Output
1
Why:
Equal numbers don't count as increasing.
Hints
Was this a good challenge?
- Solved by
- 0
- Submissions
- 0
- Accepted
- –