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/3001-3100/3039.Apply-Operations-to-Make-String-Empty/README.md
+23-14Lines changed: 23 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,37 @@
1
1
# [3039.Apply Operations to Make String Empty][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`.
5
+
6
+
Consider performing the following operation until `s` becomes **empty**:
7
+
8
+
- For **every** alphabet character from `'a'` to `'z'`, remove the **first** occurrence of that character in `s` (if it exists).
9
+
10
+
For example, let initially `s = "aabcbbca"`. We do the following operations:
11
+
12
+
- Remove the underlined characters `s = "aabcbbca"`. The resulting string is `s = "abbca"`.
13
+
- Remove the underlined characters `s = "abbca"`. The resulting string is `s = "ba"`.
14
+
- Remove the underlined characters `s = "ba"`. The resulting string is `s = ""`.
15
+
16
+
Return the value of the string `s` right **before** applying the **last** operation. In the example above, answer is `"ba"`.
7
17
8
18
**Example 1:**
9
19
10
20
```
11
-
Input: a = "11", b = "1"
12
-
Output: "100"
21
+
Input: s = "aabcbbca"
22
+
Output: "ba"
23
+
Explanation: Explained in the statement.
13
24
```
14
25
15
-
## 题意
16
-
> ...
17
-
18
-
## 题解
26
+
**Example 2:**
19
27
20
-
### 思路1
21
-
> ...
22
-
Apply Operations to Make String Empty
23
-
```go
24
28
```
25
-
29
+
Input: s = "abcd"
30
+
Output: "abcd"
31
+
Explanation: We do the following operation:
32
+
- Remove the underlined characters s = "abcd". The resulting string is s = "".
33
+
The string just before the last operation is "abcd".
0 commit comments