You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/3101-3200/3170.Lexicographically-Minimum-String-After-Removing-Stars/README.md
+22-13Lines changed: 22 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,37 @@
1
1
# [3170.Lexicographically Minimum String After Removing Stars][title]
2
2
3
-
> [!WARNING|style:flat]
4
-
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5
-
6
3
## Description
4
+
You are given a string `s`. It may contain any number of `'*'` characters. Your task is to remove all `'*'` characters.
5
+
6
+
While there is a `'*'`, do the following operation:
7
+
8
+
- Delete the leftmost `'*'` and the **smallest** non-`'*'` character to its left. If there are several smallest characters, you can delete any of them.
9
+
10
+
Return the **lexicographically smallest** resulting string after removing all `'*'` characters.
7
11
8
12
**Example 1:**
9
13
10
14
```
11
-
Input: a = "11", b = "1"
12
-
Output: "100"
13
-
```
15
+
Input: s = "aaba*"
14
16
15
-
## 题意
16
-
> ...
17
+
Output: "aab"
17
18
18
-
## 题解
19
+
Explanation:
19
20
20
-
### 思路1
21
-
> ...
22
-
Lexicographically Minimum String After Removing Stars
23
-
```go
21
+
We should delete one of the 'a' characters with '*'. If we choose s[3], s becomes the lexicographically smallest.
0 commit comments