300. Longest Increasing Subsequence
300. Longest Increasing Subsequence
Description
Difficulty: Medium
Related Topics: Array, Binary Search, Dynamic Programming
Given an integer array nums
, return the length of the longest strictly increasing subsequence.
Example 1:
1 | Input: nums = [10,9,2,5,3,7,101,18] |
Example 2:
1 | Input: nums = [0,1,0,3,2,3] |
Example 3:
1 | Input: nums = [7,7,7,7,7,7,7] |
Constraints:
1 <= nums.length <= 2500
- -104 <= nums[i] <= 104
Follow up: Can you come up with an algorithm that runs in O(n log(n))
time complexity?
Hints/Notes
- 2023/10/27
- dp
- 0x3F’s solution(checked)
Solution
Language: C++
nlogn solution:
1 | class Solution { |
1 | class Solution { |