Tiger's leetcode solution: Remove Duplicate Letters
Q: 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" A: public class Solution { public String removeDuplicateLetters(String s) { Set foundSet = new HashSetRead full article from Tiger's leetcode solution: Remove Duplicate Letters
No comments:
Post a Comment