shlogg · Early preview
Md Ariful Haque @mah-shamim

Average Waiting Time Of Customers In A Restaurant

Average waiting time = (2 + 6 + 7) / 3 = 5 for customers [[1,2],[2,5],[4,3]]. Chef prepares food in order of arrival. Waiting time = finish time - arrival time.

1701. Average Waiting Time
Medium
There is a restaurant with a single chef. You are given an array customers, where customers[i] = [arrivali, timei]:

arrivali is the arrival time of the ith customer. The arrival times are sorted in non-decreasing order.
timei is the time needed to prepare the order of the ith customer.

When a customer arrives, he gives the chef his order, and the chef starts preparing it once he is idle. The customer waits till the chef finishes preparing his order. The chef does not prepare food for more than one customer at a time. The chef prepares food for customers in t...