1509. Minimum Difference Between Largest and Smallest Value in Three Moves
Содержание
class Solution:
def minDifference(self, nums: List[int]) -> int:
n = len(nums)
if n < 5:
return 0
nums.sort()
res = inf
for l in range(4):
r = 3 - l
res = min(res, nums[n - 1 - r] - nums[l])
return res