Get Maximum Throughput (Fungible)

Problem Overview

  • Group servers into clusters of three to maximize system_throughput, the sum of each cluster’s median host throughput.
  • Input: int array host_throughput[n]; Output: long maximum system_throughput; each server can be used at most once, unused servers allowed.
  • Constraints: 1 ≤ n ≤ 2e5, 1 ≤ host_throughput[i] ≤ 1e9; the cluster median is the 2nd largest of the three.
  • Real-world context: optimizing database query times across host clusters.
  • From Amazon interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: