Count the occurrences of pattern in text, counting overlapping ones ("aa" occurs 3 times in "aaaa"). pattern is not empty.
For text = "aaaa" and pattern = "aa" the answer is 3.
The starter code compares letter by letter at every start. It is correct but too slow on repetitive texts.
Example 1
Input:
count_overlapping('aaaa', 'aa')
Output:
3
Example 2
Input:
count_overlapping('abababa', 'aba')
Output:
3
0 <= len(text) <= 2000001 <= len(pattern) <= 2000No results yet
Run your code to check it against the examples, or submit to run every test.