Need to add some more test cases

  • 0

    This code is definitely wrong, but it passes all the cases.

    def repeatedSubstringPattern(self, str)
        for i in range(2, len(str) + 1):
            if len(str) % i == 0:
                s, d = 0, len(str) / i 
                return str[s: s + d] == str[s + d: s + d * 2]
        return False

  • 0

    @ma390149401 You are right, if you don't mean "definitely wrong" is because it miss a colon in the first line. If the number of group is odd, it will return wrong answer, for example, "ababab" will return False.

  • 0

    @ma390149401 Test cases were added, now this solution gets Wrong Answer.

Log in to reply

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