Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0406fe1

Browse files
committed
Variable name modified
1 parent 88248f2 commit 0406fe1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/main/java/com/leetcode/strings/AnagramsInString.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ private static List<Integer> findAllAnagramsInTextNaive(String text, String patt
2020

2121
char[] patternChars = pattern.toCharArray();
2222
Arrays.sort(patternChars); // takes O(m log m) time
23-
String sortedPattern = String.valueOf(patternChars);
23+
String patternSorted = String.valueOf(patternChars);
2424

2525
String subText;
2626
char[] subTextChars;
27-
String sortedSubText;
27+
String subTextSorted;
2828

2929
for (int i = 0; i <= textLen - patternLen; i++) { // loops n-m number of times
3030
subText = text.substring(i, i + patternLen);
3131
subTextChars = subText.toCharArray();
3232
Arrays.sort(subTextChars); // sorts m number of characters, takes O(m log m)
33-
sortedSubText = String.valueOf(subTextChars);
33+
subTextSorted = String.valueOf(subTextChars);
3434

35-
if (sortedSubText.equals(sortedPattern)) { // compare m characters takes m time
35+
if (subTextSorted.equals(patternSorted)) { // compare m characters takes m time
3636
indexes.add(i);
3737
}
3838
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /