. - 力扣(LeetCode)

 
from typing import List
 
 
class Solution:
	def minimumAverage(self, nums: List[int]) -> float:
		# 由题意得nums长度为偶数,所以将nums按照大小排序,然后取前后两个元素的平均值,取最小值即可。
		nums.sort()
		result = (nums[0] + nums[-1]) / 2
		for i in (range(len(nums) // 2)):
			result = min(result, (nums[i] + nums[-(i + 1)]) / 2)
		return result