Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a7053d3

Browse files
Merge pull request youngyangyang04#2863 from Cwlrin/master
docs:补充【0459.重复的子字符串.md】的 JavaScript 、C# 代码
2 parents 861c770 + 734f624 commit a7053d3

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

‎problems/0459.重复的子字符串.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,29 @@ var repeatedSubstringPattern = function (s) {
689689
};
690690
```
691691

692+
> 正则匹配
693+
```javascript
694+
/**
695+
* @param {string} s
696+
* @return {boolean}
697+
*/
698+
var repeatedSubstringPattern = function(s) {
699+
let reg = /^(\w+)1円+$/
700+
return reg.test(s)
701+
};
702+
```
703+
> 移动匹配
704+
```javascript
705+
/**
706+
* @param {string} s
707+
* @return {boolean}
708+
*/
709+
var repeatedSubstringPattern = function (s) {
710+
let ss = s + s;
711+
return ss.substring(1, ss.length - 1).includes(s);
712+
};
713+
```
714+
692715
### TypeScript:
693716

694717
> 前缀表统一减一
@@ -894,8 +917,10 @@ impl Solution {
894917
}
895918
```
896919
### C#
920+
921+
> 前缀表不减一
922+
897923
```csharp
898-
// 前缀表不减一
899924
public bool RepeatedSubstringPattern(string s)
900925
{
901926
if (s.Length == 0)
@@ -920,6 +945,13 @@ public int[] GetNext(string s)
920945
}
921946
```
922947

948+
> 移动匹配
949+
```csharp
950+
public bool RepeatedSubstringPattern(string s) {
951+
string ss = (s + s).Substring(1, (s + s).Length - 2);
952+
return ss.Contains(s);
953+
}
954+
```
923955
### C
924956

925957
```c

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /