Back to problems

Make Power Non-decreasing

Algorithm · Amazon · Medium

A cloud provider runs a scalable application across n servers. The servers’ computational power levels must end up in non‑decreasing order. You are allowed to perform the following operation any number of times: Choose a contiguous subarray (any single range of consecutive servers). Choose a positive integer x. Increase every server’s power inside that subarray by x. The cost of one operation is the chosen value x. Your task is to achieve a non‑decreasing power arrangement…

Checking your access…