Algorithm · Oracle · Medium
An online service receives n requests. Their arrival times, in seconds, are stored in the array requestTime, already sorted in non-decreasing order. Your task is to determine how many arrivals must be rejected by the rate limiter. For an arrival at second t, the service checks three inclusive ranges that end at t: the same-second range [t, t], the last-ten-second range [t-9, t], and the last-sixty-second range [t-59, t]. A request is rejected if accepting it would cause any…
Checking your access…