Dropped Requests π
On Amazon Prime Day, non-critical requests for a transaction system are routed through a throttling gateway to ensure that the network is not choked by non-essential requests. The gateway has the following limits:
Any request that exceeds any of the above limits will be dropped by the gateway. Given the times at which different requests arrive sorted ascending, find how many requests will be dropped.
Note: Even if a request is dropped it is still considered for future calculations. Although, if a request is to be dropped due to multiple violations, it is still counted only once.
Complete the function droppedRequests in the editor.
droppedRequests has the following parameter(s):
List: an ordered list of integers that represent the times of various requestsrequestTime
Returns
int: the total number of dropped requests
π₯ 1003 thanks to the real MVP spike! π
1Example 1
2Example 2
3Example 3
Constraints
Limits and guarantees your solution can rely on.
1 β€ n β€ 1061 β€ requestTime[i] β€ 109