Roblox·Software Engineer·Technical Phone Screen
- Design and implement an in-memory sliding-window rate limiter that tracks requests per user. The API should be a single method that takes a user ID and a timestamp in milliseconds, and returns whether the request is allowed given a max of N requests in the last W milliseconds.
- Extend the rate limiter so each request also carries a game ID. A request is only allowed if it passes both a per-user limit and a per-game limit independently. How do you structure this, and what are the complexity and eviction trade-offs?
“My first instinct was a fixed window and I had to catch myself before saying it out loud.”