Data Structures & AlgorithmsHardGATE CS · competitive programming

Ten people stand in a circle numbered 1 to 10. Counting from person 1, every 3rd person is eliminated and removed, and counting continues around the circle. Who survives (1-based)?

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

Correct answer: B. 4

The eliminations run 3, 6, 9, 2, 7, 1, 8, 5, 10, so the survivor is person 4. Person 7 is the survivor for a different step size, the trap.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic