Panda Guru LogoPanda
Guru

Reddit tech screen - senior software engineer

Round 1

Questions: Let's pair code a program that can do scoring for a game: The game has exactly 2 players. Each player scores 1pt at a time. Each player starts with 0 points. The player with a score >= 4 wins but they must win by 2 pts.

  1. Write a function that returns the current score.
  2. Write a function that increments the score of a given player, error if the game is already over.
  3. Write a function that returns which player won or an error when the game is not over yet.

Congrats, you basically implemented the scoring mechanism for Tennis! In our modified tennis game, sets are made up of games. A set is a group of 5 games. A player wins a set if they win 3 games. After a game is done, the same two players play another game until the set is over. Let's implement sets now.

There are a few tweaks though. Tennis has different names for the scores:

Let's update the code to handle the fact that players switch sides between games.

[execution time limit] 3 seconds (java)

[memory limit] 1 GB

Candidate's Approach

No approach provided.

Interviewer's Feedback
  • Question has a lot of follow-ups so be ready to make changes to the existing code base.
  • Problem solving is not hard but reading the problem and addressing the follow-ups and then implementation is time-consuming.
  • Make sure that you address the first two parts as soon as possible.