Skip to content

Commit dab1aa5

Browse files
authored
Update maximum-repeating-substring.cpp
1 parent 4aca882 commit dab1aa5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

C++/maximum-repeating-substring.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class Solution {
2828

2929
private:
3030
vector<int> getPrefix(const string& pattern) {
31-
vector<int> prefix(pattern.length(), -1);
31+
vector<int> prefix(size(pattern), -1);
3232
int j = -1;
33-
for (int i = 1; i < pattern.length(); ++i) {
33+
for (int i = 1; i < size(pattern); ++i) {
3434
while (j > -1 && pattern[j + 1] != pattern[i]) {
3535
j = prefix[j];
3636
}
@@ -75,9 +75,9 @@ class Solution2 {
7575

7676
private:
7777
vector<int> getPrefix(const string& pattern) {
78-
vector<int> prefix(pattern.length(), -1);
78+
vector<int> prefix(size(pattern), -1);
7979
int j = -1;
80-
for (int i = 1; i < pattern.length(); ++i) {
80+
for (int i = 1; i < size(pattern); ++i) {
8181
while (j > -1 && pattern[j + 1] != pattern[i]) {
8282
j = prefix[j];
8383
}

0 commit comments

Comments
 (0)