Skip to content

Commit 1595fb3

Browse files
committed
459-repeated-substring-pattern.md Added Chinese solutions.
1 parent 0b06341 commit 1595fb3

3 files changed

Lines changed: 23 additions & 82 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.idea/
22
temp/
3-
en/empty-template.md
4-
zh/empty-template.md
3+
en/empty-template-en.md
4+
zh/empty-template-zh.md

en/1-1000/459-repeated-substring-pattern.md

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
# 459. Repeated Substring Pattern - LeetCode Solution
2-
LeetCode English link: [459. Repeated Substring Pattern](https://leetcode.com/problems/repeated-substring-pattern)
1+
# 459. Repeated Substring Pattern - LeetCode Solution Best Practice
2+
LeetCode link: [459. Repeated Substring Pattern](https://leetcode.com/problems/repeated-substring-pattern), difficulty: **Easy**.
33

4-
LeetCode Chinese link: [459. 重复的子字符串](https://leetcode.cn/problems/repeated-substring-pattern)
5-
6-
[中文题解](#中文题解)
7-
8-
## LeetCode problem description
4+
## Description of "459. Repeated Substring Pattern"
95
Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
106

11-
Difficulty: **Easy**
12-
137
### [Example 1]
148
**Input**: `s = "abcabcabcabc"`
159

@@ -27,8 +21,6 @@ Difficulty: **Easy**
2721
- `s` consists of lowercase English letters.
2822

2923
## Intuition behind the Solution
30-
[中文题解](#中文题解)
31-
3224
The key to solving this problem is to see clearly that if `s` can be obtained by repeating the substring, then the starting letter of the substring must be `s[0]`.
3325
Once you understand this, the scope of substring investigation is greatly narrowed.
3426

@@ -93,24 +85,3 @@ var repeatedSubstringPattern = function (s) {
9385
```
9486
// Welcome to create a PR to complete the code of this language, thanks!
9587
```
96-
97-
## 力扣“459. 重复的子字符串”问题描述
98-
力扣链接:[459. 重复的子字符串](https://leetcode.cn/problems/repeated-substring-pattern), 难度: **简单**
99-
100-
给定一个非空的字符串 `s` ,检查是否可以通过由它的一个子串重复多次构成。
101-
102-
### [示例 1]
103-
**输入**: `s = "abcabcabcabc"`
104-
105-
**输出**: `true`
106-
107-
**解释**: `可由子串 "abc" 重复四次构成。 (或子串 "abcabc" 重复两次构成。)`
108-
109-
### [示例 2]
110-
**输入**: `s = "aba"`
111-
112-
**输出**: `false`
113-
114-
# 中文题解
115-
## 思路
116-
解决本问题的关键是要看清楚一点:通过子串的重复能得到`s`,那么子串的起始字母一定是`s[0]`。想明白了这一点,子串的排查范围就大大缩小了。

zh/1-1000/459-repeated-substring-pattern.md

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
1-
# 459. Repeated Substring Pattern - LeetCode Solution
2-
LeetCode English link: [459. Repeated Substring Pattern](https://leetcode.com/problems/repeated-substring-pattern)
3-
4-
LeetCode Chinese link: [459. 重复的子字符串](https://leetcode.cn/problems/repeated-substring-pattern)
5-
6-
[中文题解](#中文题解)
7-
8-
## LeetCode problem description
9-
Given a string `s`, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
1+
# 459. 重复的子字符串 - 力扣题解最佳实践
2+
力扣链接:[459. 重复的子字符串](https://leetcode.cn/problems/repeated-substring-pattern), 难度: **简单**
103

11-
Difficulty: **Easy**
4+
## 力扣“459. 重复的子字符串”问题描述
5+
给定一个非空的字符串 `s` ,检查是否可以通过由它的一个子串重复多次构成。
126

13-
### [Example 1]
14-
**Input**: `s = "abcabcabcabc"`
7+
### [示例 1]
8+
**输入**: `s = "abcabcabcabc"`
159

16-
**Output**: `true`
10+
**输出**: `true`
1711

18-
**Explanation**: `It is the substring "abc" four times or the substring "abcabc" twice.`
12+
**解释**: `可由子串 "abc" 重复四次构成。 (或子串 "abcabc" 重复两次构成。)`
1913

20-
### [Example 2]
21-
**Input**: `s = "aba"`
14+
### [示例 2]
15+
**输入**: `s = "aba"`
2216

23-
**Output**: `false`
17+
**输出**: `false`
2418

25-
### [Constraints]
19+
### [约束]
2620
- `1 <= s.length <= 10000`
27-
- `s` consists of lowercase English letters.
28-
29-
## Intuition behind the Solution
30-
[中文题解](#中文题解)
21+
- `s` 由小写英文字母组成
3122

32-
The key to solving this problem is to see clearly that if `s` can be obtained by repeating the substring, then the starting letter of the substring must be `s[0]`.
33-
Once you understand this, the scope of substring investigation is greatly narrowed.
23+
## 思路
24+
解决本问题的关键是要看清楚一点:通过子串的重复能得到`s`,那么子串的起始字母一定是`s[0]`。想明白了这一点,子串的排查范围就大大缩小了。
3425

35-
## Complexity
36-
* Time: `O(N * N)`.
37-
* Space: `O(N)`.
26+
## 复杂度
27+
* 时间:`O(N * N)`
28+
* 空间:`O(N)`
3829

3930
## Python
4031
```python
@@ -93,24 +84,3 @@ var repeatedSubstringPattern = function (s) {
9384
```
9485
// Welcome to create a PR to complete the code of this language, thanks!
9586
```
96-
97-
## 力扣“459. 重复的子字符串”问题描述
98-
力扣链接:[459. 重复的子字符串](https://leetcode.cn/problems/repeated-substring-pattern), 难度: **简单**
99-
100-
给定一个非空的字符串 `s` ,检查是否可以通过由它的一个子串重复多次构成。
101-
102-
### [示例 1]
103-
**输入**: `s = "abcabcabcabc"`
104-
105-
**输出**: `true`
106-
107-
**解释**: `可由子串 "abc" 重复四次构成。 (或子串 "abcabc" 重复两次构成。)`
108-
109-
### [示例 2]
110-
**输入**: `s = "aba"`
111-
112-
**输出**: `false`
113-
114-
# 中文题解
115-
## 思路
116-
解决本问题的关键是要看清楚一点:通过子串的重复能得到`s`,那么子串的起始字母一定是`s[0]`。想明白了这一点,子串的排查范围就大大缩小了。

0 commit comments

Comments
 (0)