Maximum Running Time of N Computers LeetCode solution in Python

1
# Runtime: 1321 ms (Top 44.04%) | Memory: 28.7 MB (Top 24.77%)
2
class Solution:
3
def maxRunTime(self, n: int, batteries: List[int]) -> int:
4
batteries.sort()
5
total = sum(batteries)
6
while batteries[-1] > total // n:
7
n -= 1
8
total -= batteries.pop()
9
return total // n

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0