Data Structures & AlgorithmsHardTCS NQT · Infosys
What is the lexicographically smallest string obtainable by deleting exactly one character from cbabc?
- A. babc
- B. cbbc
- C. cbab
- 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.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many length-3 windows of the string aabxaaba have at most one position that differs from the pattern aab?
- How many binary strings of length 6 contain no two consecutive 1s?
- How many integers x with 1 <= x <= 500 are divisible by exactly one of 6 and 8?
- What is the value of the expression (1^2) + (2^2) + ... + (50^2) modulo 7?
- How many ordered pairs (a, b) with 1 <= a, b <= 30 satisfy a^2 + b^2 divisible by 7?
- A bank of 4 workers each processes one task per minute, and tasks arrive as a queue. In a single pass over the array of task lengths [3…