I am doing a leetcode exercise
https://leetcode.com/problems/remove-duplicate-letters/
The question is:
# Given a string which contains only lowe
String comparison usually can be done in 2 ways:
aacccccc
is less than ab
because at second position b
has been met (and a
< b
).Second one may be faster if length of strings are known.
You question contains small error:
why Given "bcabc" then the answer would be "acdb"
While origin was: "Given "bcabc" Return "abc"". That make sense that abc
should be returned instead of bca