Longest Increasing Subsequence
hardmicrosoft
0 views
0 likes
dynamic programming array binary search sequence
Problem Description
Given an array of integers, find the length of the longest subsequence where each element in the subsequence is strictly greater than the preceding one. Note that the subsequence does not need to be contiguous.
Constraints:
- The array's length n satisfies 1 ≤ n ≤ 3000.
- Each element in the array is an integer in the range [-10^4, 10^4].
Example:
- Input: [10, 9, 2, 5, 3, 7, 101, 18]
- Output: 4
- Explanation: The longest increasing subsequence is [2, 3, 7, 101], which has a length of 4.
Click to load code editor