leetcode在力扣 App 中打开
调试中...
调试中...
题目描述
题目描述
题解
题解
提交记录
提交记录
代码
代码
测试用例
测试用例
测试结果
测试结果
中等
相关标签
相关企业
提示

返回 s 字典序最小的,该子序列包含 s 的所有不同字符,且只包含一次。

 

示例 1:

输入:s = "bcabc"
输出"abc"

示例 2:

输入:s = "cbacdcbc"
输出:"acdb"

 

提示:

  • 1 <= s.length <= 1000
  • s 由小写英文字母组成

 

注意:该题与 316 https://leetcode.cn/problems/remove-duplicate-letters/ 相同

通过次数
34K
提交次数
56.7K
通过率
59.9%


相关企业

提示 1
Greedily try to add one missing character. How to check if adding some character will not cause problems ? Use bit-masks to check whether you will be able to complete the sub-sequence if you add the character at some index i.


评论 (0)

贡献者
© 2025 领扣网络(上海)有限公司
0 人在线
行 1,列 1
s =
"bcabc"
Source