Skip to content

Files

Latest commit

42bda89 · Mar 10, 2022

History

History
57 lines (35 loc) · 1.25 KB

File metadata and controls

57 lines (35 loc) · 1.25 KB

中文文档

Description

Given a string s, return the lexicographically smallest subsequence of s that contains all the distinct characters of s exactly once.

 

Example 1:

Input: s = "bcabc"
Output: "abc"

Example 2:

Input: s = "cbacdcbc"
Output: "acdb"

 

Constraints:

  • 1 <= s.length <= 1000
  • s consists of lowercase English letters.

 

Note: This question is the same as 316: https://leetcode.com/problems/remove-duplicate-letters/

Solutions

Python3

Java

...