Maximize Minimum Deployment Difficulty
Reported by candidates from JP Morgan's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks most first attempts at this JP Morgan question is maximizing the score instead of protecting against the worst one. It was reported in October 2026, and it reads like a partition puzzle but behaves like a sorting problem. You split every module into three nonempty servers, then the adversary picks one difficulty per server to make |d1-d2| + |d2-d3| as small as possible. Your job is to arrange the groups so even that worst pick is large. With up to 200000 modules, brute force is dead on arrival. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and gives you a working solution.
The problem
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[]) → int Examples Example 1 difficulty = [1,2,3] return = 3 Case 1 exercises the documented deterministic contract. Example 2 difficulty = [1,2,3,7,8,15,20,21] return = 24 Case 2 exercises the documented deterministic contract. Example 3 difficulty = [5,5,5] return = 0 Case 3 exercises the documented deterministic contract. Constraints 3 <= difficulty.length <= 200000. 0 <= difficulty[i] <= 10^8.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Read the objective as max over distributions of min over picks. That's a max-min, so you reason about the adversary first. For any fixed distribution, the smallest score comes from the closest-together values the adversary can reach across neighboring servers, so only the extremes of each group matter, not the interior. That tells you sorting is the first move, and that clean contiguous or near-contiguous groupings in sorted order are the candidates worth checking. Then ask which server plays the middle role, since d2 is the pivot of both absolute values. The common pitfall is evaluating the best pick instead of the worst, which gives wrong answers on tiny cases like all-equal values, where the answer is 0. Another is an O(n^2) or O(n^3) scan over split points that times out. Sort, test your reasoning on the three given examples by hand, then reduce to a linear pass over candidate boundaries. If the reasoning gets tangled live, StealthCoder is your hedge.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Maximize Minimum Deployment Difficulty cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass JP Morgan's OA.
JP Morgan reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximize Minimum Deployment Difficulty FAQ
How hard is Maximize Minimum Deployment Difficulty really?+
Medium-hard. The code is short once you see it, but the max-min framing trips people up. The hard part is working out what the adversary's worst pick looks like for a given split. Constraints up to 200000 mean the final solution has to be about O(n log n) or better.
What's the trick to this problem?+
Think from the adversary's side. The minimum score depends on how close values in neighboring servers can get, so sort first and focus on the boundary values of each group. Interior elements of a group rarely change the answer, which cuts the search space down hard.
Was this JP Morgan question reported recently?+
Yes. It was reported in October 2026 by a candidate who took the JP Morgan OA. Questions get reworded, but max-min partition problems with sorting at the core keep showing up, so the reasoning carries over even if the story changes.
What edge cases should I test?+
Test the minimum length of 3, where each server gets exactly one module. Test all-equal values like [5,5,5], which must return 0. Test duplicates mixed with distinct values, and a large input with values near 10^8 to confirm nothing overflows or runs too slowly.
How do I prepare in 48 hours?+
Skip broad grinding. Practice a handful of max-min and partition problems where you reason about the worst case first. Hand-trace the three examples here until the logic clicks. Then write one clean sorted-boundary solution and time yourself on a 200000-element input.