316. Remove Duplicate Letters
String Stack Greedy Monotonic Stack
Problem - Remove Duplicate Letters
Medium
Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
Example 1:
Input: s = "bcabc" Output: "abc"
Example 2:
Input: s = "cbacdcbc" Output: "acdb"
Constraints:
1 <= s.length <= 104sconsists of lowercase English letters.
Note: This question is the same as 1081: https://leetcode.com/problems/smallest-subsequence-of-distinct-characters/
Solutions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Submission Stats:
- Runtime: 0 ms (100.00%)
- Memory: 17.8 MB (46.70%)