Per-IP Sliding-Window Rate Limiter

Asked at Ramp · Coding Questions · Difficulty: Medium · Last asked Sep 29, 2025

A service receives a stream of requests, each with a timestamp and a source IP address. Decide for every request whether to accept or reject it, so that no single IP address has more than a fixed number of accepted requests inside any rolling time window.

Loading the problem…