1184. Number of Longest Increasing Subsequences

MediumDynamic ProgrammingLIS Family

Given an array nums, return the number of longest strictly increasing subsequences. The input is JSON {nums}.

Input: JSON {nums}.

Output: Integer — the count of longest increasing subsequences.

Examples

Example 1
Input: {"nums":[1,3,5,4,7]}
Output: 2
Explanation: [1,3,4,7] and [1,3,5,7].
Example 2
Input: {"nums":[2,2,2,2,2]}
Output: 5
Explanation: Each single 2.
Example 3
Input: {"nums":[1,2,3]}
Output: 1
Explanation: One longest subsequence.

Constraints

Asked by

AmazonMicrosoftGoogleAdobeFlipkart
Solve this problem in the editor →