← 返回 goldmansachs 的题目列表Efficient Tasks
类型:online_judge
Given an array difficulty of length n, where difficulty[i] represents the difficulty of the i-th software module. The modules need to be distributed among 3 servers such that each server has at least one module, and each module is assigned to exactly one server. After distribution, select one module from each server (any module can be selected), and compute the formula: |d1 - d2| + |d2 - d3|, where d1, d2, and d3 are the difficulties of the selected modules from the three servers. Find the 'maximum of the minimum values' among all distribution methods.
Example
Input
5
1 2 3 4 5