Amazon Coding Question – Solved

6 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 |

Asked in: Amazon

Image of the Question

Question Image

All Testcases Passed ✔



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |