Tap here to switch tabs
Problem
Submissions

Problem: Smallest K-Length Subsequence With Letter Occurrences

Smallest K-Length Subsequence With Letter Occurrences returns the lexicographically smallest fixed-length subsequence of a string containing a given letter at least a specified number of times.

Statement

Given a string s, an integer k, a character letter, and an integer repetition, return the lexicographically smallest subsequence of s of length k that contains letter at least repetition times.

A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

Constraints:

  • 1≤1 \leq repetition ≤\leq k ≤\leq s.length ≤5×104\leq 5 \times 10^4

  • s consists of lowercase English letters.

  • letter is a lowercase English letter, and appears in s at least repetition times.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest K-Length Subsequence With Letter Occurrences

Smallest K-Length Subsequence With Letter Occurrences returns the lexicographically smallest fixed-length subsequence of a string containing a given letter at least a specified number of times.

Statement

Given a string s, an integer k, a character letter, and an integer repetition, return the lexicographically smallest subsequence of s of length k that contains letter at least repetition times.

A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

Constraints:

  • 1≤1 \leq repetition ≤\leq k ≤\leq s.length ≤5×104\leq 5 \times 10^4

  • s consists of lowercase English letters.

  • letter is a lowercase English letter, and appears in s at least repetition times.