The developers at Amazon want to perform a reliability drill on some servers. There are n servers where the ith server can serve request[i] number of requests and has an initial health of health[i] units.
Each second, the developers send the maximum possible number of requests that can be served by all the available servers. With the request, the developers can also send a virus to one of the servers that can decrease the health of a particular server by k units. The developers can choose the server where the virus should be sent. A server goes down when its health is less than or equal to 0.
After all the servers are down, the developers must send one more request to conclude the failure of the application.
Find the minimum total number of requests that the developers must use to bring all the servers down.
Complete the function minimumRequests in the editor.
minimumRequests has the following parameters:
- 1.
int[] request: an array of integers representing the number of requests each server can serve - 2.
int[] health: an array of integers representing the initial health of each server - 3.
int k: an integer representing the health decrease caused by the virus
Returns
int: the minimum total number of requests to bring all the servers down
request = [3, 4] health = [4, 6] k = 3 return = 21

n == request.length == health.lengthn >= 1request[i] >= 1for each serverihealth[i] >= 1for each serverik >= 1
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jul 2026
- Closest Version DateONSITE INTERVIEW · Seen Jul 2026
- Maximum Concurrent Processes (Bar Raiser Round)ONSITE INTERVIEW · Seen Jul 2026
- Maximum Product New RatingOA · Seen Jul 2026
- Permutation SorterOA · Seen Jul 2026
- Get Distinct Pairs (Also apply to AS intern)Seen Jul 2026
- Maximum Final ValueSeen Jul 2026
- Minimum Delivery Center InconvenienceOA · Seen Jun 2026
public int minimumRequests(int[] request, int[] health, int k) {
// write your code here
}