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 "bcabc" Return "abc"
Given "cbacdcbc" Return "acdb"
我的解法:
def remove_duplicate_letters(s)
s.chars.sort.uniq.join
end
感觉我没有理解题目的意思。但是我也没看懂题目到底是啥需求?