Practice Using a Robot to Print the Lexicographically Smallest String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Using a Robot to Print the Lexicographically Smallest String
Problem Statement
The robot buffer t and output paper start empty. Repeatedly either remove the first character of s and append it to t, or remove the last character of t and append it to the paper. Continue until both s and t are empty. Return the lexicographically smallest possible output.
Source: Using a Robot to Print the Lexicographically Smallest String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "zza"
"azz"
# Example 2
s = "bac"
"abc"
# Example 3
s = "bdda"
"addb"
Constraints
Related LeetCode Problems
Practice more problems similar to Using a Robot to Print the Lexicographically Smallest String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.