FastPrepMax Transfer Rate
Problems/Max Transfer Rate

Max Transfer Rate

Amazon logoAmazon● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

You work on Amazon's Cloud Infrastructure Team. You are helping to improve how data flows through a network of storage servers.

There are n storage servers. The integer array throughput gives the throughput of each server.

There are pipelineCount data pipelines. Each pipeline connects to two servers: a primary server and a backup server. The transfer rate of a pipeline is the throughput of its primary server plus the throughput of its backup server.

Each pipeline must use a different pair of servers. The pair (x, y) means server x is the primary and server y is the backup. The pairs (x, y) and (y, x) count as different pairs. A pipeline may also use the same server for both, as the pair (x, x).

Return the largest possible total transfer rate of all pipelines.

Function

maxTransferRate(throughput: int[], pipelineCount: int) → long

Complete the function maxTransferRate in the editor.

maxTransferRate has the following parameters:

  • int throughput[n]: the throughput of each server
  • int pipelineCount: the number of data pipelines

Returns long: the largest possible total transfer rate

Examples

Example 1

throughput = [4, 2, 5]pipelineCount = 4return = 36

Servers are numbered from 1. There are 3 * 3 = 9 possible pairs: [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2] and [3, 3]. Their rates are 8, 6, 9, 6, 4, 7, 9, 7 and 10. Each pipeline needs a different pair, so take the four largest rates: [3, 3] = 5 + 5 = 10, [1, 3] = 4 + 5 = 9, [3, 1] = 5 + 4 = 9 and [1, 1] = 4 + 4 = 8. The total is 10 + 9 + 9 + 8 = 36. The answer is 36.

Constraints

  • 1 <= n <= 2 * 10^4, where n is the length of throughput
  • 1 <= throughput[i] <= 10^5
  • 1 <= pipelineCount <= n * n

More Amazon interview questions

  • Get Smallest Base SegmentOA · Seen Nov 2026
  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
  • Minimum Grid InconvenienceOA · Seen Nov 2026
  • 3SumPHONE SCREEN · Seen Nov 2026
  • Circular Primes Below a LimitPHONE SCREEN · Seen Nov 2026
  • Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
  • Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
  • Cheapest Flights Within K StopsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Maximum Three-Server Difficulty ScoreVisa · OAVisa interview questions
  • Delete and Freeze GameRubrik · OARubrik interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Return Exact Cash Register ChangeBank of America · OA
  • Round Prices to Match TargetAirbnb · OAAirbnb interview questions
  • Apartment Housemate PreferencesGoogle · PHONE SCREENGoogle interview questions
  • Fair Electoral Vote ApportionmentBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Minimum Fuel Car AlignmentFivetran · PHONE SCREENFivetran interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Server InvestmentRippling · OARippling interview questions

Amazon interview experiences

  • Amazon SWE OA with AI Coding: 1 Experience
  • Amazon SWE Intern Phone Screen Interview Experience: 1 Experience
  • Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
  • Amazon BIE Intern SQL and Interview Questions: 17 Experiences
  • Amazon Experienced SWE AI-Assisted Debugging OA: 1 Experience
  • Amazon SDE II (L5) Interview Questions: 5 Experiences
See Amazon hiring insights
Saved
class Solution {
    public long maxTransferRate(int[] throughput, int pipelineCount) {
      // write your code here
    }

}
Checking account…