As reported: JPMorgan Chase online assessment (HackerRank, 2026): "Maximize Minimum Deployment Difficulty".
You are given an integer array difficulty of length n, the difficulty of each of n software modules. Distribute all modules among three servers so that every server gets at least one module and every module goes to exactly one server.
For a fixed distribution, pick one module from each server — d1 from server 1, d2 from server 2, d3 from server 3. The deployment difficulty of that pick is
|d1 − d2| + |d2 − d3|
The minimum deployment difficulty of the distribution is the smallest value of this expression over all possible picks. Find the distribution that makes this minimum as large as possible, and return that maximum value.
Example 1
difficulty = [3,7,1,3] -> 10
Server 1 = {3, 3}, server 2 = {7}, server 3 = {1}. Every pick has d2 = 7, d1 = 3, d3 = 1, so the minimum is |3 − 7| + |7 − 1| = 10, and no distribution does better.
Example 2
difficulty = [17,8,2,1] -> 25
Server 1 = {8, 2}, server 2 = {17}, server 3 = {1}: the cheapest pick takes d1 = 8, giving |8 − 17| + |17 − 1| = 25.
Clarifications
- The servers are labelled: server 2's module is the middle term, compared with both of the others.
- Equal difficulties may appear and may go to different servers.
Constraints: 3 ≤ n ≤ 10^5; 1 ≤ difficulty[i] ≤ 10^9. The answer can approach 2 · 10^9, so return a 64-bit integer.
Code runner format: one line holding difficulty as a JSON array. Implement maxMinDeploymentDifficulty(difficulty); the harness prints the answer.