python3:
不快乐每日一题 靠题解过日子中
class Solution:
def repeatedStringMatch(self, a: str, b: str) -> int:
times = len(b) // len(a)
x = times * a
y = (times + 1) * a
z = (times + 2) * a
if b in x:
return times
elif b in y:
return times + 1
elif b in z:
return times + 2
else:
return -1