LeetCode 300, Medium. Topics: Array, Binary Search, Dynamic Programming. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 15 parametrized pytest cases, and a playground notebook:
Problem
Given an integer array nums, return the length of the longest strictly increasing subsequence.
Examples
Constraints
1 <= nums.length <= 2500
-10^4 <= nums[i] <= 10^4
Follow up: Can you come up with an algorithm that runs in O(n log(n)) time complexity?
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
Grind, Blind 75, NeetCode 150, NeetCode 250, NeetCode All, AlgoMaster 75. Last modified on September 7, 2026