#3170

Lexicographically Minimum String After Removing Stars

specialist · 865 · lc medium +31 · 51% accepted · 589 likes · top 40%

Description

Given a string s containing '*' characters, repeatedly remove the leftmost '*' together with the smallest non-'*' character to its left (any occurrence works if tied). Return the lexicographically smallest string that remains after all stars are removed.

Code

1
2
3