方法2是比较啰嗦的,每次记录厨师做完菜的时间,放到数组中, 每次去判断客人到的时候,跟厨师做完菜的时间,根据这个区判断客人的等待时间。 最后返回数值即可; classSolution{publicdoubleaverageWaitingTime(int[][]customers){/*记录每顿饭完成的时间 */int n=customers.length;int[]finish=newint[n];finish[0]=cu...
2) The second customer arrives at time 2, the chef takes his order and starts preparing it at time 3, and finishes at time 8, so the waiting time of the second customer is 8 - 2 = 6. 3) The third customer arrives at time 4, the chef takes his order and starts preparing it a...