Skip to content

#2390 - Removing Stars From a String

MediumStack
Open on LeetCode

Given a string s containing lowercase letters and stars *, in one operation a star removes the closest non-star character to its left as well as itself. Return the string after all stars have been processed. The input is guaranteed to always produce a valid result.

InputOutput
s = "leet**cod*e""lecoe"
s = "erase*****"""

Released under the MIT License.