FastPrepFastPrep
Problem Brief

Maximize Power Values Sum 🪴

OA
See Google online assessment and hiring insights

You are provided with an array containing N power values, each representing a specific power level. Additionally, a value K is given, signifying that choosing a power value X excludes any other power values within the range of X-K to X+K exclude X itself. Your objective is to determine the maximum sum achievable by selecting the optimal power values.

1Example 1

Input
powerValues = [1, 2, 3, 10, 9], k = 2
Output
13
Explanation
No explanation is provided for now 🐡

Constraints

Limits and guarantees your solution can rely on.

Unknown for now 😉
public int maximizePowerValuesSum(int[] powerValues, int k) {
    // write your code here
}
Input

powerValues

[1, 2, 3, 10, 9]

k

2

Output

13

Sign in to submit your solution.