> For the complete documentation index, see [llms.txt](https://blessbingo.gitbook.io/garnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blessbingo.gitbook.io/garnet/suan-fa/zi-fu-chuan/1081-bu-tong-zi-fu-de-zui-xiao-zi-xu-lie.md).

# \[1081]\[困难]\[贪心]\[栈] 不同字符的最小子序列

## 题目描述

[1081. 不同字符的最小子序列](https://leetcode-cn.com/problems/smallest-subsequence-of-distinct-characters/)

返回字符串 text 中按字典序排列最小的子序列，该子序列包含 text 中所有不同字符一次。

示例 1：

```
输入："cdadabcc"
输出："adbc"
```

示例 2：

```
输入："abcd"
输出："abcd"
```

示例 3：

```
输入："ecbacba"
输出："eacb"
```

示例 4：

```
输入："leetcode"
输出："letcod"
```

提示：

* 1 <= text.length <= 1000
* text 由小写英文字母组成

注意：本题目与[316. 去除重复字母](https://leetcode-cn.com/problems/remove-duplicate-letters/)相同.

## 解题思路

解法参考: [\[316\]\[困难\]\[贪心\]\[栈\] 去除重复字母](broken://pages/-MAqMC3Z1AV_XNmeymiN).
