Tap here to switch tabs
Problem
Submissions

Problem: Smallest Subsequence of Distinct Characters

Try to solve the Smallest Subsequence of Distinct Characters problem.

Statement

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

Note: This question is the same as LeetCode 316316.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Subsequence of Distinct Characters

Try to solve the Smallest Subsequence of Distinct Characters problem.

Statement

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

Note: This question is the same as LeetCode 316316.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s consists of lowercase English letters.