Incremental Partitioning Problem Statement
Given two integers N and K, determine how many ways you can partition the number N into K non-empty groups such that the size of each group[i] >= group[i-1] for each valid i. Report the result modulo 1e9 + 7.
Input:
The first line contains an integer 'T', indicating the number of test cases.
Each test case consists of a single line with two space-separated integers, N and K.
Output:
For each test case, output the number of ways modulo 1e9 + 7 on a new line.
Example:
Consider there is 1 test case and the input is:
Input:
1
5 3
Output:
2
This indicates that there are 2 ways to partition 5 into 3 groups with the specified constraints.
Constraints:
- 1 <= T <= 10
- 1 <= N <= 1000
- 1 <= K <= N
Note:
The output should be computed with a modulo of 1e9 + 7.
Be the first one to answer
Add answer anonymously...
Top Expedia Group Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Top HR questions asked in Expedia Group Software Developer Intern
>
Expedia Group Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app