LeetCode 673, Medium. Topics: Array, Dynamic Programming, Segment Tree. 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 number of longest increasing subsequences.
Notice that the sequence has to be strictly increasing.
Examples
Constraints
- 1 <= nums.length <= 2000
- -10^6 <= nums[i] <= 10^6
- The answer is guaranteed to fit inside a 32-bit integer.
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
NeetCode All. Last modified on September 7, 2026