Maximize the Minimized Three-Server Difficulty Split

Asked at Goldman Sachs · Coding Questions · Difficulty: Hard · Last asked Nov 25, 2025

A deployment has `n` software modules, each with an integer difficulty rating, and exactly three servers numbered 1, 2 and 3. You decide which server runs each module. A checker then picks one module from each server and measures the spread `|d1 - d2| + |d2 - d3|`, where `dk` is the rating of the module picked from server `k`. The checker always picks the three modules that make this spread as small as possible. Choose the split that makes the checker's smallest spread as large as possible, and return that value.

Loading the problem…