362. Number of Longest Increasing Subsequences
Given an integer array nums, find the number of Longest Increasing Subsequences (LIS) in the array.
Example 1:
Input: nums = [1, 3, 5, 4, 7]
Output: 2
Explanation: There are two LIS of length 4:
[1, 3, 4, 7]
[1, 3, 5, 7].
Example 2:
Input: nums = [2, 2, 2, 2, 2]
Output: 5
Explanation: All elements are the same, so every single element can form an LIS of length 1. There are 5 such subsequences.
Now Your Turn!
Pick the correct output for the given inputInput: nums = [10, 9, 2, 5, 3, 7, 101, 18]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= nums.length <= 103
- -106 <= nums[i] <= 106