Data Structures & AlgorithmsModerateGATE CS · ICPC regional

What is the number of distinct subsequences (including the empty one) of the string abab?

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

Correct answer: C. 12

Count distinct strings, not index choices: this set includes the empty string, the single letters, and repeated patterns such as ab and aba collapsing from different index sets.

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

Exams that ask this topic