Longest Increasing Subsequence

hard
dynamic programming array binary search sequence
🏢microsoft
0 views0 likes

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.

Hints

[object Object]

[object Object]

[object Object]