0% completed
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.
Example 1:
[2, 6, 4, 3, 5]
2
[2, 3, 5]
and [2, 4, 5]
, both having a length of 3. Therefore, there are two such subsequences.Example 2:
[10, 9, 2, 5, 3, 7, 101, 18]
4
[2, 3, 7, 18]
, [2, 5, 7, 18]
, [2, 3, 101]
, and [2, 5, 101]
, each having a length of 4. Thus, there are four such subsequences.Example 3:
[1, 5, 2, 6, 3, 7]
3
[1, 2, 3, 7]
, [1, 2, 6, 7]
, and [1, 5, 6, 7]
.Constraints:
Try solving this question here:
.....
.....
.....