We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6130d8d + 2cdd5ac commit 0d32f4fCopy full SHA for 0d32f4f
problems/repeated-string-match/repeated_string_match.go
@@ -3,12 +3,12 @@ package problem686
3
import "strings"
4
5
func repeatedStringMatch(A string, B string) int {
6
- a, count := A, len(B)/len(A)
+ count := len(B) / len(A)
7
if len(B)%len(A) > 0 {
8
count++
9
}
10
for times := 0; times < 2; times++ {
11
- a = strings.Repeat(A, count)
+ a := strings.Repeat(A, count)
12
if strings.Index(a, B) != -1 {
13
return count
14
0 commit comments