Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

How many distinct substrings of length 4 does "abcabcabca" contain?

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

Correct answer: A. 3

Periodic strings repeat their windows; collect the length-4 windows in a set. Positional counts (the last option) ignore repetition.

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

Exams that ask this topic