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/3301-3400/3304.Find-the-K-th-Character-in-String-Game-I/README.md
+28-13Lines changed: 28 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,43 @@
1
1
# [3304.Find the K-th Character in String Game I][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
+
Alice and Bob are playing a game. Initially, Alice has a string `word = "a"`.
5
+
6
+
You are given a **positive** integer `k`.
7
+
8
+
Now Bob will ask Alice to perform the following operation **forever**:
9
+
10
+
- Generate a new string by **changing** each character in `word` to its **next** character in the English alphabet, and **append** it to the original `word`.
11
+
12
+
For example, performing the operation on `"c"` generates `"cd"` and performing the operation on `"zb"` generates `"zbac"`.
13
+
14
+
Return the value of the `kth` character in `word`, after enough operations have been done for `word` to have **at least**`k` characters.
15
+
16
+
**Note** that the character `'z'` can be changed to `'a'` in the operation.
7
17
8
18
**Example 1:**
9
19
10
20
```
11
-
Input: a = "11", b = "1"
12
-
Output: "100"
13
-
```
21
+
Input: k = 5
22
+
23
+
Output: "b"
24
+
25
+
Explanation:
14
26
15
-
## 题意
16
-
> ...
27
+
Initially, word = "a". We need to do the operation three times:
17
28
18
-
## 题解
29
+
Generated string is "b", word becomes "ab".
30
+
Generated string is "bc", word becomes "abbc".
31
+
Generated string is "bccd", word becomes "abbcbccd".
0 commit comments