Process Execution
Learn this problemProblem statement
Amazon Web Services (AWS) has millions of servers that provide on-demand cloud computing platforms to the customers.
In one AWS center, there are nprocesses to be executed and m processors to execute them. The ith process requires power[i] for execution. A processor can provide power within its range minPower through maxPower[i]. Process i can be executed on processor j if minPower[j] ≤ power[i] ≤ maxPower[j].
Given the power consumption of n processes, the range of processor power in m processors, find:
Function
processExecution(power: int[], minPower: int[], maxPower: int[]) → long[][]
Complete the function processExecution in the editor.
amazon-process-executionm
processExecution has the following parameters:
int power[n]: the power consumption of processesint minPower[m]: the minimum bounds of the ranges of processor powerint maxPower[m]: the maximum bounds of the ranges of processor power
Returns
long_int[m][2]: the #th element of this array consists of 2 integers - the number of processes that lie within the range of the #th processor, and the sum of the power consumption of those processes.
𓇢𓆸 🌷Credit to ʚ Mira ɞ ᯓᡣ𐭩。˚🌷
Examples
Example 1
power = [7, 6, 8, 10]minPower = [6, 3, 4]maxPower = [10, 7, 9]return = [[4, 31], [2, 13], [3, 21]]
Example 2
power = [11, 11, 11]minPower = [8, 13]maxPower = [11, 100]return = [[3, 33], [0, 0]]Constraints
- 1 ≤ n ≤ 12 * 10^5
- 1 ≤ m ≤ 2 * 10^5
- 1 ≤ power[i] ≤ 10^8
- 1 ≤ minPower[i] ≤ maxPower[i] ≤ 10^8
More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026