Longest increasing subsequence
Mediumdynamic programmingbinary search
Return the length of the longest strictly increasing subsequence of nums. It needn't be contiguous but must keep the original order.
Example 1
Input: nums = [10,9,2,5,3,7,101,18] Output: 4
For example 2, 3, 7, 101.
Example 2
Input: nums = [0,1,0,3,2,3] Output: 4
Example 3
Input: nums = [7,7,7,7] Output: 1
Constraints
- 1 ≤ nums.length ≤ 2500
- -10⁴ ≤ nums[i] ≤ 10⁴
Submit checks your solution against 8 tests, including hidden ones.
/**
* @param {int[]} nums
* @return {int}
*/
function lengthOfLIS(nums) {
}