Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 100
简单题,效果不够好 class Solution: def repeatedSubstringPattern(self, s: str) -> bool: a='' for i in range(len(s)): if s[i] not in a: a+=s[i] else: if a == s[i:i+len(a)]: if s==a*(len(s)//len(a)): return True else: a+=s[i] else: a+=s[i] return False 执行用时 :184