Skip to content

Commit 1bd573a

Browse files
committed
261st Commit
1 parent cf381d1 commit 1bd573a

File tree

2 files changed

+35
-1
lines changed
  • src
    • page-11/1071. Greatest Common Divisor of Strings
    • page-1/72. Edit Distance

2 files changed

+35
-1
lines changed

src/page-1/72. Edit Distance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 72. 編輯距離 (Edit Distance)
22

3-
給定兩個字串 word1 和 word2,返回將 word1 轉換為 word2 所使用的最少操作數。
3+
給定兩個字串 `word1``word2`,返回將 `word1` 轉換為 `word2` 所使用的最少操作數。
44

55
你可以對字詞進行以下三種操作:
66

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
```

0 commit comments

Comments
 (0)