ALG-M019MediumBinary Search
Longest Rising Trend
Find the length of the longest strictly increasing subsequence. Elements in a subsequence retain original order but need not be adjacent.
Contract
input numbers: integer[]
return integer
Constraints
- • 0 <= length <= 10000
Examples
Example 1
numbers = [10, 9, 2, 5, 3, 7, 101, 18]
→ 4
Example 2
numbers = [0, 1, 0, 3, 2, 3]
→ 4
5 judge tests (2 shown above). Target complexity: O(n log n).