there restaurant single chef you give array customer customersi arrivali timeiarrivali arrival time ith customer the arrival time sort nondecrease ordertimei time need prepare order ith customerWhen customer arrive give chef order chef start prepare idle the customer wait till chef finish prepare order the chef prepare food customer time the chef prepare food customer order give inputReturn average wait time customer solution 105 actual answer consider accept Example 1input customer 122543output 500000explanation1 the customer arrive time 1 chef take order start prepare immediately time 1 finish time 3 wait time customer 3 1 22 the second customer arrive time 2 chef take order start prepare time 3 finish time 8 wait time second customer 8 2 63 the customer arrive time 4 chef take order start prepare time 8 finish time 11 wait time customer 11 4 7so average wait time 2 6 7 3 5example 2input customer 5254103201output 325000explanation1 the customer arrive time 5 chef take order start prepare immediately time 5 finish time 7 wait time customer 7 5 22 the second customer arrive time 5 chef take order start prepare time 7 finish time 11 wait time second customer 11 5 63 the customer arrive time 10 chef take order start prepare time 11 finish time 14 wait time customer 14 10 44 the fourth customer arrive time 20 chef take order start prepare immediately time 20 finish time 21 wait time fourth customer 21 20 1so average wait time 2 6 4 1 4 325 Constraints1 customerslength 1051 arrivali timei 104arrivali arrivali1