Data Structures & AlgorithmsHardTCS NQT · Infosys

What is the lexicographically smallest string obtainable by deleting exactly one character from cbabc?

  1. A. babc
  2. B. cbbc
  3. C. cbab
  4. D. cabc

Correct answer: A. babc

Deleting the first character that is larger than its successor gives the smallest result. Deleting the first 'c' leaves babc.

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

Exams that ask this topic