Covid Vaccination Distribution Problem
As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to maximize the number of vaccines administered on a particular day, while adhering to certain rules.
Explanation:
Given two positive integers, n
and maxVaccines
, indicating the number of days for the vaccination drive and the total available vaccines respectively, you must find the number of vaccines distributed each day. Additionally, a specific day, dayNumber
, is provided, and you need to maximize the number of vaccines on this day.
Rules:
- A positive number of vaccines must be administered each day.
- The difference in the number of vaccines between any two consecutive days cannot exceed 1.
- The sum of vaccines distributed must not exceed
maxVaccines
. - The vaccines administered on
dayNumber
must be maximized.
Input:
The first line of input contains an integer 'T', the number of test cases. Each test case consists of one line with three integers: n
, dayNumber
, and maxVaccines
.
Output:
For each test case, output a single integer representing the maximum number of vaccines administered on the dayNumber
day. Each result should be on a new line.
Example:
Input:
T = 2
n = 3, dayNumber = 1, maxVaccines = 6
n = 4, dayNumber = 2, maxVaccines = 10
Output:
3
4
Constraints:
1 <= T <= 50
1 <= n <= maxVaccines <= 10^9
0 <= dayNumber < n
- Time Limit: 1 sec
Note:
No need to print output; just implement the function logic as needed.
Be the first one to answer
Add answer anonymously...
Top Ernst & Young React Developer interview questions & answers
Popular interview questions of React Developer
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