Lexicographically Smallest String After Adjacent Removals - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
3563. Lexicographically Smallest String After Adjacent Removals
Hard
50 Points
String
Dynamic Programming
You are given a string s consisting of lowercase English letters.
You can perform the following operation any number of times (including zero):
Return the lexicographically smallest string that can be obtained after performing the operations optimally.
Note: Consider the alphabet as circular, thus 'a' and 'z' are consecutive.
Examples
Example 1
Input: s = "abc"
Output: "a"
Explanation:
Example 2
Input: s = "bcda"
Output: ""
Explanation:
Example 3
Input: s = "zdce"
Output: "zdce"
Explanation:
Constraints
1 <= s.length <= 250
s consists only of lowercase English letters.
3563. Lexicographically Smallest String After Adjacent Removals
Hard
50 Points
String
Dynamic Programming
You are given a string s consisting of lowercase English letters.
You can perform the following operation any number of times (including zero):
Return the lexicographically smallest string that can be obtained after performing the operations optimally.
Note: Consider the alphabet as circular, thus 'a' and 'z' are consecutive.