Average Waiting Time LeetCode solution in Python
1class Solution:2def averageWaitingTime(self, customers: List[List[int]]) -> float:3start = customers[0][0]4end = start + customers[0][1]5total_wait = end - start6for c in customers[1:]:7start = c[0]8if start <= end:9end += c[1]10total_wait = total_wait + end - start11else:12end = c[0] + c[1]13total_wait += c[1]14return total_wait / len(customers)