π Exclusive Offer! Join our
Telegram Channel
to get **special discounts** and updates! π
Question 56 - 100% Working Solution | Buy Now
Description
9 Live
After all the servers are down, the developers must send one more request to conclude the failure of the application.
The developers at Amazon want to perform a reliability drill on some servers. There are n servers where the i-th 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.
Find the minimum total number of requests that the developers must use to bring all the servers down.
Example
Consider n = 2, request = [3, 4], health = [4, 6], k = 3.
The minimum number of requests required is 21.
| No. of Requests | Virus Server | Serverβs New Health | Total Requests |
|----------------|--------------|----------------------|----------------|
| 3 + 4 = 7 | 1 | 6 - 3 = 3 | 7 |
| 3 + 4 = 7 | 1 | 3 - 3 = 0 (server 1 dies) | 14 |
| 3 | 0 | 4 - 3 = 1 | 17 |
| 1 | 0 | 1 - 3 = -2 (server 0 dies) | 18 |
| - | - | - (conclude the failure) | 21 |