1668. Maximum Repeating Substring - Test Case Bug?

Hi Mods,

Wanted to bring this to your attention, it seems like the output test case: 166/211 is bad.

Here are the specific inputs
sequence = "aaabaaaabaaabaaaabaaaabaaaabaaaaba"
word = "aaaba"

It seems like there are 6 instances of the word in sequence, yet, the checker expects 5.

Someone else also seems to be having an issue with the same test case:
https://leetcode.com/problems/maximum-repeating-substring/discuss/1100523/Is-166-211-test-case-wrong

Here's my solution

    def maxRepeating(self, sequence: str, word: str) -> int:
        match_count = 0

        i = 0
        while i < len(sequence):
            if sequence[ i : i+len(word) ] == word:
                match_count += 1
                i += len(word)
            else:
                i += 1

        return match_count

image

Thanks a lot

Comments (1)