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