Maximize Minimum Deployment Difficulty
Problem statement
Distribute every module among three nonempty servers. Afterward, one difficulty d1, d2, and d3 is selected from servers 1, 2, and 3. The selected score is |d1-d2| + |d2-d3|.
For a distribution, its deployment difficulty is the minimum selected score over all allowed choices. Return the largest deployment difficulty attainable by a distribution.
Function
maximizeMinimumDeploymentDifficulty(difficulty: int[]) → intExamples
Example 1
difficulty = [1,2,3]return = 3Case 1 exercises the documented deterministic contract.
Example 2
difficulty = [1,2,3,7,8,15,20,21]return = 24Case 2 exercises the documented deterministic contract.
Example 3
difficulty = [5,5,5]return = 0Case 3 exercises the documented deterministic contract.
Constraints
3 <= difficulty.length <= 200000.0 <= difficulty[i] <= 10^8.