Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: A game uses 5 players in a circle numbered 1 to 5. The player with the ball passes it 3 positions clockwise each turn (the ball moves from the current player to the player three steps ahead). Starting with player 1, after 12 passes, which player holds the ball?

  1. A. 3
  2. B. 1
  3. C. 2
  4. D. 4

Correct answer: C. 2

Each pass advances the holder by three positions modulo the circle size. Counting 12 passes as moving 12 positions without wrapping gives a different player.

More Coding Interview Problems questions

Exams that ask this topic