Practice Number of Ways to Earn Points
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
There is a test that has n types of questions. You are given an integer target and a 0-indexed 2D integer array types where types[i] = [counti, marksi] indicates that there are counti questions of the ith type, and each one of them is worth marksi points. Return the number of ways you can earn exactly target points in the exam. Since the answer may be too large, return it modulo 10^9 + 7. Note that questions of the same type are indistinguishable.
Source: Number of Ways to Earn Points on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
target = 6, types = [[6,1],[3,2],[2,3]]
7
# Example 2
target = 5, types = [[50,1],[50,2],[50,5]]
4
# Example 3
target = 18, types = [[6,1],[3,2],[2,3]]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Number of Ways to Earn Points.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.