We can discuss the details with candidates that successfully demonstrate proficiency through completion of our basic pre requisite screening. for Python
Sample code is available for review upon request.
Tom is a salesman. He has a goal of selling T total units over the span of next D days. Because of some restrictions from his supplier he can only sell at most d(i) items in a day. Fortunately for him, his supplier has provided him a list of the maximum number of items he can sell each day for the D days in advance. Can you help him to identify in how many different ways can he sell his product over the span of D days so that the sum of the total items over those days exactly end up to T. And remember, he has to sell at least 1 product each day to maintain the title of salesman.
The first line contains T, the total units you need to sell
The second line contains D, the number of days you have to meet your goal
The third line contains D numbers, each number d(i) represent the maximum number of units you can sell for the day.
0 < T <= 1000
0<D <= 200
0<d(i) <= 1000
A single number representing the total number of ways you can achieve your goal.
Print the answer modulo : 10^9 + 7
Sample Inputs below
2 3 4
Sample Output 0
To make the sum 5, and keeping the constraint of atleast 1 sale per day, below are the following 5 ways to sell goods
1 1 3
1 3 1
2 2 1
2 1 2
1 2 2
Sample Input 1
1 1 1 1
Sample Output 1
There is no way to meet his goal of selling 2 items for the next 4 days because of one of the two reasons:
If he keeps the rule of selling one item per day then he will sell more than 2 items and exceed his goal.
If he sells only two item then he wont be able to keep his title of salesman because of the at least one item per day limit.
You may attach a link or send your python file in response with the test cases.