← Reddit Interview Insights

Reddit·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Got a coding question from Reddit that seemed straightforward until I actually had to think through all the edge cases. Tennis scoring is deceptively annoying to implement cleanly.

Questions Asked (1)

Q1

Implement a tennis match scoring system. Given a sequence of points won by each player, output the human-readable score at each point (Love, 15, 30, 40, Deuce, Advantage) and track the game, set, and match state correctly, including deuce and advantage logic.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I started with the basic point progression and felt fine until deuce came up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the rules and scope (e.g., best-of-3 or best-of-5 sets, tiebreak rules, input format). Then design a state machine that processes each point, updating game, set, and match states, with clear separation of concerns. Implement and test incrementally, handling deuce/advantage and set/match transitions.

Pro tip: Demonstrate maturity by discussing trade-offs: e.g., whether to use a simple state machine vs. a more complex event-driven design, and how to handle edge cases like tiebreaks. Also, mention that you'd write unit tests for critical transitions (deuce, advantage, set point, match point).

1. Clarify requirements and rules

Ask about match format (best of 3/5), tiebreak rules, input format (sequence of points), and output expectations. Confirm scoring terminology (Love, 15, 30, 40, Deuce, Advantage).

2. Design state representation

Define data structures to track points within a game, games within a set, sets within a match, and current server (if needed). Consider using enums for game states (e.g., NORMAL, DEUCE, ADVANTAGE).

3. Implement point processing logic

For each point, update the game state: handle normal scoring, deuce/advantage transitions, and game win conditions. Then update set and match states accordingly, including tiebreak logic if applicable.

4. Handle output and edge cases

Output the human-readable score after each point. Ensure correct handling of deuce, advantage, set wins, match wins, and tiebreaks. Test with edge cases like long deuce games and close sets.

5. Test and validate

Write unit tests for key scenarios: normal game, deuce/advantage, set win, match win, and tiebreak. Walk through a sample sequence to verify correctness.

Key Points to Mention

  • State machine design for game, set, and match progression
  • Deuce and advantage logic: how to transition and when a game is won
  • Set and match win conditions (e.g., 6 games with 2-game lead, tiebreak at 6-6)
  • Input parsing and output formatting for human-readable scores
  • Edge cases: long deuce games, tiebreaks, and match point
  • Testing strategy: unit tests for critical transitions and integration test with sample sequence

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