Reddit logo

Reddit Software Engineer System Design Questions

14 practice questions for Reddit Software Engineer interviews

Reddit software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
1
System Design
system design Hard Verified Question #1

1. Top 5 Reddit System Design Questions


Category: Trie-based system design problem

System Design Questions - Reddit These are the most commonly asked system design questions from Reddit interviews.

Input: Number(s)
Output: Computed result
system design Medium api design #1

1. Design RateLimiter — Implement a class to manage API request quotas


Background: Reddit supports multiple APIs, each with different request quotas per user. To prevent abuse and ensure fair usage across various clients, a robust rate limiter is essential.
Requirements:
1. Implement a method to add an API with its corresponding request quota.
2. Implement a method to check if a user can make a request to a specific API based on their current usage.
3. Implement a method to record a user's usage for a specific API.
4. Implement a method to reset a user's quota for a specific API after a designated time interval.
5. Ensure that the class is thread-safe to handle concurrent requests from multiple users.
Class API:
  • add_api(api_name: str, quota: int) -> None: Adds a new API with its request quota.

  • can_request(user_id: str, api_name: str) -> bool: Checks if the user can make a request to the given API.

  • record_request(user_id: str, api_name: str) -> None: Records a request made by the user to the given API.

  • reset_user_quota(user_id: str, api_name: str) -> None: Resets the user's quota after a designated time interval.


Example 1:
  • Input: add_api("getComments", 100) → Output: None → Explanation: A new API with a quota of 100 requests has been added.

  • Input: can_request("user123", "getComments") → Output: True → Explanation: User can make a request as they haven't exceeded the quota.


Example 2:
  • Input: record_request("user123", "getComments") → Output: None → Explanation: Request recorded.

  • Input: can_request("user123", "getComments") → Output: True/False → Explanation: Depending on the number of recorded requests.


Constraints:
  • Maximum APIs: 100

  • Maximum requests per user per API: 1000

  • Time reset limit: 1 hour

  • Users are represented by unique strings.
system design Medium api design #2

2. Design RateLimiter — A class to manage API usage limits for multiple APIs.

Background: Reddit needs to ensure that users don’t exceed the allowed rate for various APIs to maintain service quality and prevent abuse. The RateLimiter class should handle different quotas for each user per API efficiently.
Requirements:
1. The class should allow setting up rate limits for different users and APIs.
2. The rate limiting needs to support different request quotas for various APIs.
3. Track the number of requests made by each user for each API.
4. Provide a method to check if a user can make an API request based on their current usage and the API's limit.
5. Implement a way to reset the counts after a period (e.g., daily reset).
Class API:
  • def set_limit(user_id: str, api_name: str, limit: int, period: int) -> None: Sets the rate limit for a particular user on a specific API.

  • def can_request(user_id: str, api_name: str) -> bool: Checks if a user can request an API call without exceeding the limit.

  • def record_request(user_id: str, api_name: str) -> None: Records an API request for a user.

  • def reset_usage(user_id: str, api_name: str) -> None: Resets the usage for a user on a specific API after the defined period.

Example 1:
Input sequence of method calls:
set_limit('user123', 'api1', 5, 60)
record_request('user123', 'api1')
can_request('user123', 'api1')
Output: True
Explanation: User 'user123' has set a limit of 5 requests on 'api1' and has made 1 request, so they can make more requests.
Example 2:
Input sequence of method calls:
set_limit('user123', 'api1', 2, 30)
record_request('user123', 'api1')
record_request('user123', 'api1')
can_request('user123', 'api1')
Output: False
Explanation: User 'user123' has made 2 requests against the limit of 2 on 'api1' and cannot make another request until reset.
Constraints:
  • Max users: 10^4

  • Max APIs: 10^3

  • Max requests per user: 10^5

Related Reddit Software Engineer interview prep

Start practicing Reddit questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free