File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
page-11/1071. Greatest Common Divisor of Strings Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1
1
# 72. 編輯距離 (Edit Distance)
2
2
3
- 給定兩個字串 word1 和 word2,返回將 word1 轉換為 word2 所使用的最少操作數。
3
+ 給定兩個字串 ` word1 ` 和 ` word2 ` ,返回將 ` word1 ` 轉換為 ` word2 ` 所使用的最少操作數。
4
4
5
5
你可以對字詞進行以下三種操作:
6
6
Original file line number Diff line number Diff line change
1
+ # 1071. 字串的最大公因數 (Greatest Common Divisor of Strings)
2
+
3
+ 對於兩個字串 ` s ` 和 ` t ` ,只有在 ` s = t + t + t + ... + t + t ` (即 ` t ` 與自身連接一次或多次) 時,我們才認定「` t ` 可以整除 ` s ` 」。
4
+
5
+ 給定兩個字串 ` str1 ` 和 ` str2 ` ,返回最長的字串 ` x ` ,使得 ` x ` 可以同時整除 ` str1 ` 和 ` str2 ` 。
6
+
7
+ 範例 1:
8
+
9
+ ``` coffee
10
+ 輸入: str1 = " ABCABC" , str2 = " ABC"
11
+ 輸出: " ABC"
12
+ ```
13
+
14
+ 範例 2:
15
+
16
+ ``` coffee
17
+ 輸入: str1 = " ABABAB" , str2 = " ABAB"
18
+ 輸出: " AB"
19
+ ```
20
+
21
+ 範例 3:
22
+
23
+ ``` coffee
24
+ 輸入: str1 = " LEET" , str2 = " CODE"
25
+ 輸出: " "
26
+ ```
27
+
28
+ ## 解題
29
+
30
+ ``` ts
31
+ export const gcdOfStrings: GcdOfStrings = (str1 , str2 ) => {
32
+ //
33
+ };
34
+ ```
You can’t perform that action at this time.
0 commit comments