Amazon Coding Question – Solved

12 Live
GetMaxThroughput The developers at Amazon are working on optimizing database query times. There are n host servers, where the throughput of the i-th host server is given by host_throughput[i]. These servers are grouped into clusters of size three. The throughput of a cluster, denoted as cluster_throughput, is defined as the median of the three servers’ throughput values. Each host server can be part of at most one cluster, and some servers may remain unused. The total system throughput, called system_throughput, is the sum of the throughputs of all the clusters formed. The task is to find the maximum possible system throughput. Note: The median of a cluster of three host servers is the 2nd highest throughput when the three values are sorted in ascending or descending order. Example: Input: n = 5 host_throughput = [2, 3, 4, 3, 4] Output: The maximum number of clusters that can be formed is 1, and two host servers will remain unused.

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