Skip to content

Practice Number of Longest Increasing Subsequence

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#673
LeetCode Problem

Number of Longest Increasing Subsequence

Problem Statement

Given an integer array nums, return the number of longest increasing subsequences. Notice that the sequence has to be strictly increasing.

Source: Number of Longest Increasing Subsequence on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,3,5,4,7]
Output
2

# Example 2

Input
nums = [2,2,2,2,2]
Output
5

Constraints

1 <= nums.length <= 2000
-10^6 <= nums[i] <= 10^6
The answer is guaranteed to fit inside a 32-bit integer.

Related LeetCode Problems

Practice more problems similar to Number of Longest Increasing Subsequence.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.