Practice Count of Sub-Multisets With Bounded Sum
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Count of Sub-Multisets With Bounded Sum
Problem Statement
Count unordered sub-multisets of nums whose sum is between l and r inclusive. Each value may be selected from zero times up to its occurrence count in nums. Selections with the same value multiplicities count once regardless of which equal-valued indices supplied them. The empty selection has sum 0. Return the count modulo 10^9 + 7.
Source: Count of Sub-Multisets With Bounded Sum on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [1,2,2,3], l = 6, r = 6
1
# Example 2
nums = [2,1,4,2,7], l = 1, r = 5
7
# Example 3
nums = [1,2,1,3,5,2], l = 3, r = 5
9
Constraints
Related LeetCode Problems
Practice more problems similar to Count of Sub-Multisets With Bounded Sum.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.