Data Structures & AlgorithmsModerateTCS NQT · Codeforces Div2 B

Deleting exactly one character from "110100" gives a new binary string each time. How many DISTINCT strings result?

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

Correct answer: A. 4

Deleting from a run of equal characters gives the same string regardless of which letter in the run is removed, so runs collapse. Counting the six deletion positions overcounts repeated results.

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

Exams that ask this topic