Back to course home
0% completed
Solution: Number of Longest Increasing Subsequence
Problem Statement
Given an integer array nums
, return the number of longest increasing subsequences.
A subsequence
is derived from the array by deleting
some or no elements without changing the order of the remaining elements
Note: Sequences should be strictly increasing.
Examples
-
Example 1:
- Input: nums =
[2, 6, 4, 3, 5]
- Expected Output:
2
- Explanation: The longest increasing subsequences are
[2, 3, 5]
and[2, 4, 5]
, both having a length of 3. Therefore, there are two such subsequences.
- Input: nums =
-
Example 2:
- Input: nums =
.....
.....
.....
Like the course? Get enrolled and start learning!