Class Solution
java.lang.Object
g1001_1100.s1081_smallest_subsequence_of_distinct_characters.Solution
1081 - Smallest Subsequence of Distinct Characters.<p>Medium</p>
<p>Given a string <code>s</code>, return <em>the lexicographically smallest subsequence of</em> <code>s</code> <em>that contains all the distinct characters of</em> <code>s</code> <em>exactly once</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “bcabc”</p>
<p><strong>Output:</strong> “abc”</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “cbacdcbc”</p>
<p><strong>Output:</strong> “acdb”</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 1000</code></li>
<li><code>s</code> consists of lowercase English letters.</li>
</ul>
<p><strong>Note:</strong> This question is the same as 316: <a href="https://leetcode.com/problems/remove-duplicate-letters/" target="_top">https://leetcode.com/problems/remove-duplicate-letters/</a></p>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
smallestSubsequence
-