https://leetcode.com/problems/minimum-average-of-smallest-and-largest-elements/description/
1
2
3
4
5
6
7
8
9
10
|
class Solution:
def minimumAverage(self, nums: List[int]) -> float:
nums.sort()
averages = []
for i in range(len(nums)//2):
averages.append((nums[i] + nums[-(i+1)])/2)
return min(averages)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
3300. Minimum Element After Replacement With Digit Sum (0) | 2024.10.05 |
---|---|
leetcode 3210. Find the Encrypted String (0) | 2024.09.23 |
3232. Find if Digit Game Can Be Won (0) | 2024.09.21 |
3285. Find Indices of Stable Mountains (0) | 2024.09.21 |
3190. Find Minimum Operations to Make All Elements Divisible by Three (0) | 2024.09.19 |
댓글