Data Structures & AlgorithmsHardGATE CS · ICPC regional

A singly linked list contains the people 1 to 12 in a circle. Starting from person 1, every 4th person is removed (the count starts at 1) until one remains. Which person survives?

  1. A. 2
  2. B. {C+7}
  3. C. 4
  4. D. 1

Correct answer: D. 1

Simulate with a circular list: rotate k-1 times then remove. An off-by-one in the rotation count changes the survivor.

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

Exams that ask this topic