Rearrange Server Load

Problem Overview

  • Rearrange serverLoad to minimize the sum of serverCapacity[i] * serverLoad[i]; if there are multiple answers, return the lexicographically smallest arrangement.
  • Input: two int arrays, serverCapacity and serverLoad, both of length n. Output: the reordered serverLoad array.
  • Domain: server workload distribution and capacity planning to reduce total resource use.
  • This coding interview problem from Ibm interviews is an interview question; implement rearrangeServerLoad(serverCapacity, serverLoad).

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: