← Back
00:00

Ping-Pong Match Scorer

Reddit interview questions · Hard · Coding round · 7 tests

Build a scoring system for a competitive ping-pong match. Players score one point at a time, and the game follows standard table-tennis endgame rules: the first player to reach 11 points wins, but a player must lead by at least 2. If both players reach 10, the game enters deuce and continues until someone leads by 2.

Interface

class PingPongMatchScorer {
  constructor(playerOne: string, playerTwo: string)
  pointWonBy(player: string): void
  getScore(): string
  isFinished(): boolean
}
Idle