Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

A linked list holds 1, 2, 3, 4, 5, 6, 7. Reversing each complete group of 3 nodes (leaving a final incomplete group unchanged) gives which node order?

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

Correct answer: A. 3 2 1 6 5 4 7

Reverse each full group of k nodes; the last incomplete group keeps its order. Reversing the entire list is a different operation.

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

Exams that ask this topic