Get Smallest String
Problem Overview
- Given a lowercase string, select exactly one non-empty substring and replace each character with its previous alphabet letter (a wraps to z) once.
- Input: string s; Output: the lexicographically smallest resulting string; constraint: 1 ≤ |s| ≤ 1e5.
- Domain: string manipulation and lexicographic ordering relevant to real-world text processing.
- Source: asked in Ibm interviews; a common coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
