← 返回 amazon 的题目列表Count Remaining Requests with FIFO and Maximum Wait Times
类型:online_judge
amazon
At a certain time, only one request can be processed. Requests are processed in First In First Out (FIFO) order. Each request has a maximum waiting time wait[i], and if it is not processed by this time, it is discarded. Given an array of maximum waiting times wait, find out how many requests remain when the processing happens every second in FIFO order. Number of requests is n = 4, wait = [2, 3, 1, 2].
Example
Input
4
2 3 1 2