673. Number of Longest Increasing Subsequence Medium

@problem@discussion
#Array#Dynamic Programming#Binary Indexed Tree#Segment Tree



1/**
2 * [673] Number of Longest Increasing Subsequence
3 *
4 * Given an integer array nums, return the number of longest increasing subsequences.
5 * Notice that the sequence has to be strictly increasing.
6 *  
7 * Example 1:
8 * 
9 * Input: nums = [1,3,5,4,7]
10 * Output: 2
11 * Explanation: The two longest increasing subsequences are [1, 3, 4, 7] and [1, 3, 5, 7].
12 * 
13 * Example 2:
14 * 
15 * Input: nums = [2,2,2,2,2]
16 * Output: 5
17 * Explanation: The length of the longest increasing subsequence is 1, and there are 5 increasing subsequences of length 1, so output 5.
18 * 
19 *  
20 * Constraints:
21 * 
22 * 	1 <= nums.length <= 2000
23 * 	-10^6 <= nums[i] <= 10^6
24 * 
25 */
26pub struct Solution {}
27
28// problem: https://leetcode.com/problems/number-of-longest-increasing-subsequence/
29// discuss: https://leetcode.com/problems/number-of-longest-increasing-subsequence/discuss/?currentPage=1&orderBy=most_votes&query=
30
31// submission codes start here
32
33impl Solution {
34    pub fn find_number_of_lis(nums: Vec<i32>) -> i32 {
35        0
36    }
37}
38
39// submission codes end
40
41#[cfg(test)]
42mod tests {
43    use super::*;
44
45    #[test]
46    fn test_673() {
47    }
48}
49


Back
© 2025 bowen.ge All Rights Reserved.