Tap here to switch tabs
Problem
Submissions

Problem: Lexicographically Minimum String After Removing Stars

Lexicographically Minimum String After Removing Stars gives a string with letters and stars. Remove each leftmost star with the smallest letter to its left, and return the smallest string.

Statement

You are given a string s that contains lowercase English letters and the character '*'.

You must eliminate all '*' characters by repeatedly performing the following operation:

  • Select the leftmost '*' in s.

  • Delete this '*' alongside the smallest character other than '*' situated to its left. If there are multiple occurrences of the smallest character, any one of them may be deleted.

Return the lexicographically smallest string that can be formed after removing all '*' characters.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of lowercase English letters and '*'.

  • The input is generated such that it is possible to delete all '*' characters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Lexicographically Minimum String After Removing Stars

Lexicographically Minimum String After Removing Stars gives a string with letters and stars. Remove each leftmost star with the smallest letter to its left, and return the smallest string.

Statement

You are given a string s that contains lowercase English letters and the character '*'.

You must eliminate all '*' characters by repeatedly performing the following operation:

  • Select the leftmost '*' in s.

  • Delete this '*' alongside the smallest character other than '*' situated to its left. If there are multiple occurrences of the smallest character, any one of them may be deleted.

Return the lexicographically smallest string that can be formed after removing all '*' characters.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of lowercase English letters and '*'.

  • The input is generated such that it is possible to delete all '*' characters.