Skip to content

Instantly share code, notes, and snippets.

@lantzbuilds
Created January 27, 2026 21:45
Show Gist options
  • Select an option

  • Save lantzbuilds/5e03d97450c4a9a6b9998a70604bc4bd to your computer and use it in GitHub Desktop.

Select an option

Save lantzbuilds/5e03d97450c4a9a6b9998a70604bc4bd to your computer and use it in GitHub Desktop.
Backend Engineer II - Rate Limiter Coding Exercise (Candidate Instructions)

Rate Limiter — Coding Exercise

Overview

Build a simple rate limiter in Python that restricts how many requests a user can make per minute. You have approximately 15 minutes.

Requirements

Implement a class with the following method:

is_allowed(user_id) -> bool
  • Returns True if the request is allowed
  • Returns False if the user has exceeded their rate limit
  • Each user is allowed N requests per minute (you can make N configurable, default to 10)

Example Usage

limiter = RateLimiter(max_requests=5)  # 5 requests per minute per user

limiter.is_allowed("user-123")  # True (1st request)
limiter.is_allowed("user-123")  # True (2nd request)
limiter.is_allowed("user-123")  # True (3rd request)
limiter.is_allowed("user-123")  # True (4th request)
limiter.is_allowed("user-123")  # True (5th request)
limiter.is_allowed("user-123")  # False (exceeded limit)

limiter.is_allowed("user-456")  # True (different user, separate limit)

# After 1 minute passes...
limiter.is_allowed("user-123")  # True (limit resets)

Notes

  • Focus on getting a working solution first
  • Think aloud as you work — we want to understand your thought process
  • Feel free to ask clarifying questions
  • You may use AI coding assistants if that's part of your normal workflow
  • Consider: How do you track time? When does the "minute" window start/reset?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment