← Reddit Interview InsightsSoftware Engineer

Reddit·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Got a coding question at Reddit that looked straightforward on the surface but had enough edge cases to trip you up if you weren't careful. Tennis scoring is one of those problems where the logic is clear in your head until you actually have to implement deuce and advantage 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) along with the current game, set, and match state. Make sure deuce and advantage are handled correctly.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I started with the point scoring and thought I had it nailed, then the deuce/advantage loop tripped me 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 sets, tiebreak rules) to ensure alignment. Then design a modular system with separate classes for Point, Game, Set, and Match, each handling its own state transitions. Implement the scoring logic with careful handling of deuce/advantage and edge cases like tiebreaks.

Pro tip: Demonstrate test-driven development by walking through key scenarios (e.g., deuce, advantage, set point) and discussing how you'd unit test each component. This shows maturity and reduces bugs.

1. Clarify Requirements

Ask about match format (best of 3/5), tiebreak rules, and whether to include sets/match or just games. Confirm input format (sequence of points) and expected output.

2. Design Data Model

Define classes for Point, Game, Set, and Match with clear responsibilities. Use enums for point scores (LOVE, FIFTEEN, etc.) and states (DEUCE, ADVANTAGE).

3. Implement Game Logic

Handle point progression, including deuce and advantage. Ensure that after deuce, a player must win two consecutive points to win the game.

4. Integrate Set and Match Logic

Implement set winning conditions (6 games with 2-game lead, tiebreak at 6-6) and match winning (best of 3/5 sets). Propagate game wins to sets and sets to match.

5. Test and Validate

Write unit tests for edge cases: deuce, advantage, tiebreak, set point, match point. Simulate a full match to ensure correct output at each step.

Key Points to Mention

  • State machine design for game progression (e.g., from 40-40 to deuce, then advantage).
  • Handling deuce and advantage correctly: after deuce, a player must win two consecutive points.
  • Tiebreak rules: first to 7 points with 2-point lead, and how it affects set scoring.
  • Modularity and separation of concerns: separate classes for Game, Set, Match to manage complexity.
  • Edge cases: love game, bagel set, match point, and ensuring no off-by-one errors in point counting.
  • Testing strategy: unit tests for each component and integration tests for full match scenarios.

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