Company: Amazon_15june

Difficulty: medium

Problem Statement

Maximize System Throughput An engineering team is tuning how their database queries get routed across host servers. There are n host servers, where the throughput of the i th host server is given by host_throughput[i] . Host servers are grouped into clusters of exactly three. A cluster's throughput, cluster_throughput , is defined as the median of the host_throughput values of its three members. A host server can belong to at most one cluster, and it is fine to leave some servers out of any cluster. The overall system_throughput is the sum of the throughputs across every cluster that gets formed. The goal is to choose a grouping that makes system_throughput as large as possible. Note: The median throughput of a three-server cluster is whichever value lands in the middle once the three throughputs are sorted (ascending or descending, it doesn't matter). Function Description Complete the function getMaxThroughput in the editor below. getMaxThroughput has the following parameter: int host

More Amazon_15june OA questionsInterview experiences