본문 바로가기
python-algorithm

3194. Minimum Average of Smallest and Largest Elements

by 무적김두칠 2024. 9. 21.

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
반응형

댓글