Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

Rotate "abcabd" one step to the left, then count the distinct substrings of length 3 in the rotated string.

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

Correct answer: A. 4

Left rotation gives "bcabda"; its length-3 windows are bca, cab, abd and bda, all distinct. Counting windows of the original string gives a different answer.

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

Exams that ask this topic