Leetcode: Remove duplicate letters
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
Example:
Given
Return
"bcabc"
Return
"abc"
Given
Return
"cbacdcbc"
Return
"acdb"
Blogs to read:
3 solutions are discussed in the following blog:
https://www.hrwhisper.me/leetcode-remove-duplicate-letters/
https://leetcode.com/discuss/73777/easy-to-understand-iterative-java-solution
To be continued.
No comments:
Post a Comment