Practice Maximum Repeating Substring
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
For a string sequence, a string word is k-repeating if word concatenated k times is a substring of sequence. The word's maximum k-repeating value is the highest value k where word is k-repeating in sequence. If word is not a substring of sequence, word's maximum k-repeating value is 0. Given strings sequence and word, return the maximum k-repeating value of word in sequence.
Source: Maximum Repeating Substring on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
sequence = "ababc", word = "ab"
2
# Example 2
sequence = "ababc", word = "ba"
1
# Example 3
sequence = "ababc", word = "ac"
0
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Repeating Substring.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.