2390. Removing Stars From a String
Medium
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, as well as remove the star itself.
Return the string after all stars have been removed.
Note:
The input will be generated such that the operation is always possible.
It can be shown that the resulting string will always be unique.
Example 1:
Example 2:
Constraints:
1 <= s.length <= 105
s
consists of lowercase English letters and stars*
.The operation above can be performed on
s
.
解題
使用 Stack 來進行消除
Previous2389. Longest Subsequence With Limited SumNext2391. Minimum Amount of Time to Collect Garbage
Last updated