← Roblox Interview Insights

Roblox·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Roblox SWE screen, got a rate-limiting style design question that looked deceptively easy. Took me a minute to realize the naive approach had some edge cases worth talking through.

Questions Asked (1)

Q1

Design a Logger class that receives messages with timestamps and only allows the same message to be printed once every 10 seconds. Implement shouldPrintMessage(timestamp, message) returning true if the message should print, false otherwise.

Algorithms & Data StructuresSystem Design
Author's notes

My first instinct was just a hashmap from message to last-printed timestamp, which is basically the right answer, but I spent too long second-guessing it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then propose a hash map solution that stores the last printed timestamp for each message. Explain the O(1) time and space complexity, and discuss potential improvements like memory management for long-running systems.

Pro tip: Mention that in a real system, you'd need to handle memory growth by periodically cleaning up old entries or using an LRU cache, showing awareness of production concerns.

1. Clarify Requirements

Ask about timestamp units (seconds vs milliseconds), whether timestamps are monotonically increasing, and if multiple messages can have the same timestamp. Confirm the 10-second window is inclusive or exclusive.

2. Design Data Structure

Propose using a hash map (dictionary) to store the last printed timestamp for each message. This allows O(1) lookup and update.

3. Implement Logic

In shouldPrintMessage, check if the message exists in the map. If not, or if the current timestamp is at least 10 seconds greater than the stored timestamp, return true and update the map; otherwise return false.

4. Analyze Complexity

State that time complexity is O(1) per operation and space complexity is O(n) where n is the number of unique messages. Discuss trade-offs.

5. Discuss Scalability

Address memory growth in long-running systems. Suggest periodic cleanup of stale entries or using an LRU cache to bound memory usage.

Key Points to Mention

  • Hash map for O(1) lookup and update
  • Timestamp comparison: current - last >= 10
  • Handling of non-monotonic timestamps (if allowed)
  • Memory management for unbounded message growth
  • Thread safety considerations for concurrent access
  • Edge cases: first message, exact 10-second boundary, duplicate timestamps

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.