Straightforward Python Solution

  • 0
    class Solution(object):
        def repeatedSubstringPattern(self, str):
            :type str: str
            :rtype: bool
            l = len(str)
            for i in range(1, int(l/2)+1):
            	if str[:i] == str[-i:] and str[:i] * int((l/len(str[:i]))) == str:
            		return True
            return False

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.