Tap here to switch tabs
Problem
Submissions

Problem: Removing Stars From a String

med
30 min
Try to solve the Removing Stars From a String problem.

Statement

You are given a string s, which contains stars *.

In one operation, you can:

  • Choose a star in s.

  • Remove the closest non star character to its left, along with the star itself.

Return the string obtained after all stars have been removed.

Constraints:

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

  • s consists of lowercase English letters and stars *.

  • The operation above can be performed on s.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Removing Stars From a String

med
30 min
Try to solve the Removing Stars From a String problem.

Statement

You are given a string s, which contains stars *.

In one operation, you can:

  • Choose a star in s.

  • Remove the closest non star character to its left, along with the star itself.

Return the string obtained after all stars have been removed.

Constraints:

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

  • s consists of lowercase English letters and stars *.

  • The operation above can be performed on s.