← Reddit Interview Insights

Reddit·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Reddit ML Engineer interview, at least one round involved a coding problem around designing a tennis scoring system from scratch. More OOP-heavy than I expected for an ML role, felt like a general SWE screen dressed up as something else.

Questions Asked (1)

Q1

Design and implement a tennis scoring system as a class. It should track points for two players, return scores in both raw and human-readable formats (Love, 15, 30, 40, Deuce, Advantage, Game), handle the win condition (4+ points with a 2-point lead), prevent scoring after the game ends, and reset internal state during deuce cycles to keep things bounded.

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

This took longer than I thought it would.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases (e.g., deuce, advantage, game end, reset). Then design a class with clear state variables and methods, explaining the scoring logic and how you handle deuce cycles to keep state bounded. Finally, discuss trade-offs and potential extensions, and walk through test cases to validate correctness.

Pro tip: Emphasize the bounded state during deuce: by resetting points to 40-40 after each deuce cycle, you prevent integer overflow and keep the logic simple. Also, mention that you would add unit tests for all transitions, especially edge cases like advantage and game end.

1. Clarify Requirements and Edge Cases

Ask questions to confirm scoring rules, input/output formats, and constraints (e.g., singles only, no tiebreak). Identify edge cases like deuce, advantage, and scoring after game end.

2. Design Class Structure and State

Define the class with attributes for player points, game status, and methods for scoring and retrieving scores. Explain how you will represent scores (e.g., mapping points to tennis terms).

3. Implement Scoring Logic with Deuce Handling

Write the scoring method that updates points, checks for win condition (4+ points and 2-point lead), and resets points to 40-40 during deuce cycles to keep state bounded.

4. Implement Score Retrieval and Game End Prevention

Create methods to return raw and human-readable scores, and ensure scoring is disabled after the game ends (e.g., by checking a game_over flag).

5. Test and Discuss Trade-offs

Walk through test cases covering all transitions, and discuss trade-offs like simplicity vs. extensibility, and potential improvements (e.g., supporting tiebreaks).

Key Points to Mention

  • Mapping points to tennis terms: 0=Love, 1=15, 2=30, 3=40, and special cases for Deuce, Advantage, Game.
  • Win condition: at least 4 points and a lead of 2 points.
  • Deuce handling: when both players have 3+ points and scores are tied, it's Deuce; after Advantage, if the trailing player scores, reset to Deuce (40-40) to keep state bounded.
  • Preventing scoring after game end: use a boolean flag or check if game is already won.
  • Raw score format: e.g., (points_player1, points_player2) or a string like '40-30'.
  • Human-readable format: e.g., 'Advantage Player1', 'Deuce', 'Game Player2'.

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