Medium
Quiz
#316 Remove Duplicate Letters
APPROACH
Given a string s, remove duplicate characters so that each character appears exactly once. Among all valid results, return the lexicographically smallest one.
Example 1:
Input: s = "bcabc"
Output: "abc"
Example 2:
Input: s = "cbacdcbc"
Output: "acdb"
1 of 4
1:00
What is the optimal approach for this problem?