Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

Five people stand in a circle numbered 1 to 5. Starting from person 1, every third person is removed until one remains. Who survives?

  1. A. 4
  2. B. 5
  3. C. 6
  4. D. 8

Correct answer: A. 4

Removals occur in the order 3, 1, 5, 2, leaving 4. A queue simulation confirms the survivor.

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

Exams that ask this topic