Search⌘ K
AI Features

Solution: Number of Longest Increasing Subsequence

Discover how to use dynamic programming to determine the count of the longest strictly increasing subsequences within an integer array. This lesson guides you through tracking subsequence lengths and counts, implementing an algorithm with nested iterations, and understanding its time and space complexity for solving LIS-related problems.

Statement

Given an integer array nums, return the number of longest strictly increasing subsequences it contains.

A subsequence is formed by choosing elements from the array while keeping their original order, and it is considered strictly increasing if every next element is greater than the previous one.

Constraints:

  • 11 \le nums.length 2000\leq 2000

  • 106-10^{6} \leq ...