Efficient Deployments π¨οΈ
A supercomputer has several processors to deploy for execution. They
are arranged sequentially in a row from 1 to n. The efficiency of each
processor depends upon the order of deployment of its adjacent
processors.
For the ith processor, the efficiency of the ith processor is
no_adjacent[i], one_adjacent[i], or both_adjacent[i] when neither, one,
or both adjacent processors is deployed before processor i.
Note: The 1^st and n^th processors can only have one adjacent.
Find the maximum possible sum of efficiencies amongst all possible orders of deployment.
Complete the function maxEfficiency in the editor.
maxEfficiency has the following parameters:
int noAdjacent[n]: an array of integersint oneAdjacent[n]: an array of integersint bothAdjacent[n]: an array of integersReturns
long_int: the maximum possible sum of efficiencies
1Example 1
2Example 2
3Example 3
Constraints
Limits and guarantees your solution can rely on.
1 <= n <= 1051 <= no_adjacent[i], one_adjacent[i], both_adjacent[i] <= 109