Data Structures & AlgorithmsHardTCS NQT · Accenture

How many distinct substrings of length 3 does the string abcabcabd have?

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

Correct answer: D. 4

Enumerate the seven windows of length 3, then count distinct strings. Repeated windows such as abc must be counted once.

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

Exams that ask this topic