1665. Minimum Initial Energy to Finish Tasks
Содержание
class Solution:
def minimumEffort(self, tasks: List[List[int]]) -> int:
res = cur = 0
for a, m in sorted(tasks, key=lambda x: x[0] - x[1]):
if cur < m:
res += m - cur
cur = m
cur -= a
return res