2171. Removing Minimum Number of Magic Beans
Содержание
class Solution:
def minimumRemoval(self, beans: List[int]) -> int:
beans.sort()
s, n = sum(beans), len(beans)
return min(s - x * (n - i) for i, x in enumerate(beans))