Algorithm · Ramp · Medium
You receive a sequence of requests in arrival order. Every request has a timestamp in milliseconds and a source IP address. Enforce a sliding-window quota separately for each IP, determining whether every request should pass or be denied. For a request from ipAddresses[i] occurring at timestamps[i], accept it exactly when the count of earlier accepted requests from that same IP inside (timestamps[i] - timeWindow, timestamps[i]] is less than limit. The timeWindow duration is…
Checking your access…