bumpsoo 2024-07-09 22:00:34 +09:00
parent 658f8674ca
commit 9d8cb29871

View file

@ -0,0 +1,15 @@
# https://leetcode.com/problems/average-waiting-time/
from typing import List
class Solution:
def averageWaitingTime(self, customers: List[List[int]]) -> float:
available = customers[0][0]
waiting = 0;
for time in customers:
if time[0] < available:
waiting += available - time[0]
else:
available = time[0]
waiting += time[1]
available += time[1]
return waiting / len(customers)