mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-04 08:02:30 +08:00
19 lines
274 B
Go
19 lines
274 B
Go
package leetcode
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func maxRepeating(sequence string, word string) int {
|
|
for i := len(sequence) / len(word); i >= 0; i-- {
|
|
tmp := ""
|
|
for j := 0; j < i; j++ {
|
|
tmp += word
|
|
}
|
|
if strings.Contains(sequence, tmp) {
|
|
return i
|
|
}
|
|
}
|
|
return 0
|
|
}
|