Find Machine Count

Problem Overview

  • Compute the minimum cost to make any 3 regions match finalMachineCount.
  • Inputs: machineCount for n regions, finalMachineCount of size 3, shiftingCost; output: int minimum cost (n≥3, values ≤1e6).
  • Operations: add/remove one machine for cost 1 (region remains non-zero) or move all machines between regions for cost shiftingCost (source destroyed).
  • Context: server capacity rebalancing across data center regions.
  • A Cisco interviews 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: