You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2><ahref="https://leetcode.com/problems/smallest-subsequence-of-distinct-characters">1159. Smallest Subsequence of Distinct Characters</a></h2><h3>Medium</h3><hr><p>Given a string <code>s</code>, return <em>the </em><spandata-keyword="lexicographically-smaller-string"><em>lexicographically smallest</em></span> <spandata-keyword="subsequence-string"><em>subsequence</em></span><em> of</em> <code>s</code> <em>that contains all the distinct characters of</em> <code>s</code> <em>exactly once</em>.</p>
2
+
3
+
<p> </p>
4
+
<p><strongclass="example">Example 1:</strong></p>
5
+
6
+
<pre>
7
+
<strong>Input:</strong> s = "bcabc"
8
+
<strong>Output:</strong> "abc"
9
+
</pre>
10
+
11
+
<p><strongclass="example">Example 2:</strong></p>
12
+
13
+
<pre>
14
+
<strong>Input:</strong> s = "cbacdcbc"
15
+
<strong>Output:</strong> "acdb"
16
+
</pre>
17
+
18
+
<p> </p>
19
+
<p><strong>Constraints:</strong></p>
20
+
21
+
<ul>
22
+
<li><code>1 <= s.length <= 1000</code></li>
23
+
<li><code>s</code> consists of lowercase English letters.</li>
24
+
</ul>
25
+
26
+
<p> </p>
27
+
<strong>Note:</strong> This question is the same as 316: <ahref="https://leetcode.com/problems/remove-duplicate-letters/"target="_blank">https://leetcode.com/problems/remove-duplicate-letters/</a>
0 commit comments