2023-07-21 16:53:22 +0300 MSK
Repeated Substring Pattern
Links
Code
class Solution:
def repeatedSubstringPattern(self, s: str) -> bool:
length = len(s)
for i in range(length-1):
if length % (i + 1) != 0:
continue
if s == s[:i+1] * (length // (i + 1)):
return True
return False