← AT&T Interview Insights

AT&T·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Technical phone screen for a software engineer role, one coding question about building a rate limiter from scratch. Pretty implementation-heavy, more about getting the details right than any clever algorithm.

Questions Asked (1)

Q1

Implement a token bucket rate limiter class with a method that takes a number of required tokens and a timeout in seconds. The bucket starts full at 1000 tokens, refills continuously at 10 tokens per second up to the max capacity, and each call should block up to the given timeout waiting for enough tokens before returning false.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The core state is just two fields: current token count and the last refill timestamp.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a thread-safe token bucket with continuous refill and blocking acquisition. Use a lock and condition variable to manage token availability, and implement timeout handling with wait_for. Finally, discuss trade-offs and potential optimizations.

Pro tip: Mention that using a condition variable with a timed wait avoids busy-waiting and ensures fairness. Also, consider using a monotonic clock to avoid issues with system time changes.

1. Clarify requirements

Confirm the token bucket parameters: initial tokens (1000), refill rate (10 tokens/sec), max capacity (1000), and blocking behavior with timeout. Ask about thread safety and expected concurrency.

2. Design the data structure

Use a mutex to protect shared state (current tokens, last refill timestamp) and a condition variable to signal token availability. Ensure continuous refill by calculating tokens based on elapsed time.

3. Implement token acquisition

In the acquire method, lock the mutex, refill tokens, and if enough tokens are available, deduct and return true. Otherwise, wait on the condition variable with a timeout, looping until tokens are available or timeout expires.

4. Handle timeout and return value

Use wait_for with the remaining timeout. If timeout occurs, return false. Ensure that the method returns true only if tokens were successfully acquired within the timeout.

5. Discuss trade-offs and optimizations

Talk about fairness (FIFO vs. priority), performance under high contention, and potential improvements like using a lock-free approach or a dedicated refill thread.

Key Points to Mention

  • Thread safety using mutex and condition variable
  • Continuous refill calculation based on elapsed time
  • Blocking with timeout using wait_for
  • Avoiding busy-waiting and ensuring fairness
  • Handling spurious wakeups by rechecking condition
  • Trade-offs between precision and performance

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