459.重复的子字符串增加Go移动匹配解法
This commit is contained in:
parent
14ff932a45
commit
96359371d8
|
|
@ -403,6 +403,18 @@ func repeatedSubstringPattern(s string) bool {
|
|||
}
|
||||
```
|
||||
|
||||
移动匹配
|
||||
|
||||
```go
|
||||
func repeatedSubstringPattern(s string) bool {
|
||||
if len(s) == 0 {
|
||||
return false
|
||||
}
|
||||
t := s + s
|
||||
return strings.Contains(t[1:len(t)-1], s)
|
||||
}
|
||||
```
|
||||
|
||||
### JavaScript:
|
||||
|
||||
> 前缀表统一减一
|
||||
|
|
|
|||
Loading…
Reference in New Issue