🎁 Exclusive Offer! Join our Telegram Channel to get **special discounts** and updates! πŸš€

πŸš€ Struggling with coding interviews? We've got you covered! πŸ’‘ Practice real questions, sharpen your skills, and land your dream job! 🎯
Question 67 - 100% Working Solution | Buy Now

Description

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