2412. Minimum Money Required Before Transactions
Содержание
class Solution:
def minimumMoney(self, transactions: List[List[int]]) -> int:
s = sum(max(0, a - b) for a, b in transactions)
res = 0
for a, b in transactions:
if a > b:
res = max(res, s + b)
else:
res = max(res, s + a)
return res