Skip to content

Commit 19f571c

Browse files
committed
Runtime: 132 ms (Top 24.51%) | Memory: 55.2 MB (Top 53.55%)
1 parent 60fd894 commit 19f571c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/algorithms/M/Maximum Number of Non-Overlapping Substrings/Maximum Number of Non-Overlapping Substrings.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 132 ms (Top 24.51%) | Memory: 55.2 MB (Top 53.55%)
12
class Solution {
23
public List<String> maxNumOfSubstrings(String s) {
34
int n = s.length();
@@ -18,7 +19,7 @@ public List<String> maxNumOfSubstrings(String s) {
1819
bit[i].set(s.charAt(j)-'a');
1920
}
2021
}
21-
boolean go = true;
22+
boolean go = true;
2223
while(go){ // keep merging until there is no more range change.
2324
go = false;
2425
for (int i = 0; i < 26; i++){
@@ -34,7 +35,7 @@ public List<String> maxNumOfSubstrings(String s) {
3435
}
3536
List<String> ans = new ArrayList<>();
3637
boolean[] seen = new boolean[n];
37-
for (int i = 0; i < 26; i++){ // populate the answer
38+
for (int i = 0; i < 26; i++){ // populate the answer
3839
boolean ok = L[i] >= 0 && !seen[L[i]];
3940
for (int j = 0; j < 26 && ok; j++){
4041
if (i != j && L[j] >= 0){ // only take those that has no smaller valid ranges.
@@ -48,4 +49,4 @@ public List<String> maxNumOfSubstrings(String s) {
4849
}
4950
return ans;
5051
}
51-
}
52+
}

0 commit comments

Comments
 (0)