LeetCode/string/SmallestSubsequenceofDistinctCharacters.java
// Does not work, because it not guarantee it is subsequence
Does not work, because it not guarantee it is subsequence
Does not work because it not guarantee it is subsequence
public String smallestSubsequence1st(String s) {
        Set<Character> uniqueChars = new HashSet<>();
        for (char c : s.toCharArray()) {
            uniqueChars.add(c);
        }
        StringBuilder sb = new StringBuilder();
        for (char c : uniqueChars) {
            sb.append(c);
        }
        System.out.println(sb.toString());
        return sb.toString();
    }
public String smallestSubsequence1st ( String s ) { Set < Character > uniqueChars = new HashSet < > ( ) ; for ( char c : s . toCharArray ( ) ) { uniqueChars . add ( c ) ; } StringBuilder sb = new StringBuilder ( ) ; for ( char c : uniqueChars ) { sb . append ( c ) ; } System . out . println ( sb . toString ( ) ) ; return sb . toString ( ) ; }
Does not work, because it not guarantee it is subsequence
Does not work because it not guarantee it is subsequence