Make Power Non-decreasing
Problem Overview
- Given n servers with computational powers; make the sequence non-decreasing.
- Increase any contiguous segment by x; choose x values so the total added amount is minimized.
- Input: n (1–1e5) and power[i] (1–1e9). Output: the minimum total sum of x to achieve non-decreasing order.
- Real-world context: AWS horizontal scaling and server power alignment.
- From Amazon interviews; a common 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:
