Execute Processes II

Execute Processes II

FULLTIME

There are n processes 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:
the number of processes which can be executed on the processor
the sum of power consumed by the processes that it can serve

Function Description
Complete the function processExecution in the editor.

Input:
int power[n]: the power consumption of processes
int minPower[m]: the minimum bounds of the ranges of processor power
int maxPower[m]: the maximum bounds of the ranges of processor power

Returns
long_int[m][2]: the ith element of this array consists of 2 integers - the number of processes that lie within the range of the ith processor, and the sum of the power consumption of those processes.

Examples and Constraints

...




Get one-to-one training from Google Facebook engineers

Top-notch Professionals

Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.

Customized Private Class

Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.