Data Structures & AlgorithmsHard

How many DISTINCT non-empty strings can be formed as subsequences (characters taken in order, not necessarily adjacent) of "abab"?

  1. A. 11
  2. B. 15
  3. C. 10
  4. D. 12

Correct answer: A. 11

Count distinct strings, not index choices: repeated letters create identical subsequences that must be counted once. Counting index subsets gives 2^n − 1, and counting contiguous substrings gives another number.

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

Exams that ask this topic