Algorithm · Uber · Medium
Requirements Implement a rate limiter that processes requests in order and reports whether each request is permitted. limits maps a user ID to that user's limit as (N, W), where no more than N requests may be accepted during any W-second sliding window. default_limit is the (N, W) policy used for users absent from limits. requests contains (user_id, timestamp) pairs in processing order. The function must return one Boolean result per request. Return True when the request…
Checking your access…