Maximum Repeating Substring LeetCode solution in C++

1
class Solution {
2
public:
3
int maxRepeating(string sequence, string word) {
4
int k = 0;
5
string temp = word;
6

7
while (sequence.find(temp) != string::npos) {
8
temp += word;
9
k++;
10
}
11

12
return k;
13
}
14
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0