Rotate the string at every point and check


  • 0
    W
    class Solution(object):
        def repeatedSubstringPattern(self, str):
            if len(str)<2:
                return False
            else:
                l = len(str)
            for i in range(1,l):
                if str[i:]+str[:i] == str:
                    return True
            return False
            ```
            :type str: str
            :rtype: bool
            """

Log in to reply
 

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